Intra prediction-based image coding method using MPM list and apparatus therefor

ABSTRACT

An image decoding method according to the present disclosure comprises deriving a first candidate intra prediction mode based on a first neighboring block of a current block; deriving a second candidate intra prediction mode based on a second neighboring block of the current block; constructing MPM (Most Probable Mode) list of the current block based on the first candidate intra prediction mode and the second candidate intra prediction mode; deriving an intra prediction mode for the current block based on the MPM list; and generating a prediction sample for the current block based on the intra prediction mode, wherein the first neighboring block is a left neighboring block located at the lowermost side among neighboring blocks adjacent to a left boundary of the current block, and wherein the second neighboring block is an upper neighboring block located at the rightmost side among neighboring blocks adjacent to an upper boundary of the current block.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/837,857, filed on Apr. 1, 2020, which is continuation ofInternational Application PCT/KR2019/011542, with an internationalfiling date of Sep. 6, 2019, which claims the benefit of U.S.Provisional Applications No. 62/735,207 filed on Sep. 24, 2018, No.62/742,267 filed on Oct. 5, 2018, and Korean Patent Application No.10-2018-0106665 filed on Sep. 6, 2018, the contents of which are allhereby incorporated by reference herein in their entirety.

BACKGROUND OF THE DISCLOSURE Field of the Disclosure

The present disclosure relates to an image coding technique and, moreparticularly, to an image coding method using intra prediction based onan MPM list and an apparatus for the method.

Related Art

Recently, the demand for high resolution, high quality image/video suchas 4K or 8K Ultra High Definition (UHD) image/video is increasing invarious fields. As the image/video resolution or quality becomes higher,relatively more amount of information or bits are transmitted than forconventional image/video data. Therefore, if image/video data aretransmitted via a medium such as an existing wired/wireless broadbandline or stored in a legacy storage medium, costs for transmission andstorage are readily increased.

Moreover, interests and demand are growing for virtual reality (VR) andartificial reality (AR) contents, and immersive media such as hologram;and broadcasting of images/videos exhibiting image/video characteristicsdifferent from those of an actual image/video, such as gameimages/videos, are also growing.

Therefore, a highly efficient image/video compression technique isrequired to effectively compress and transmit, store, or play highresolution, high quality images/videos showing various characteristicsas described above.

SUMMARY

A technical object of the present disclosure is to provide a method forimproving image coding efficiency and an apparatus for the method.

Another technical object of the present disclosure is to provide anefficient intra prediction method and an apparatus for the method.

Yet another technical object of the present disclosure is to provide animage decoding method for deriving an MPM list for a current block andan apparatus for the method.

Still another technical object of the present disclosure is to providean image decoding method for deriving an MPM list based on neighboringblocks of a current block and an apparatus for the method.

Still yet another technical object of the present disclosure is toprovide an image decoding method for deriving an MPM list of a currentblock based on a plurality of conditions and an apparatus for themethod.

According to one embodiment of the present disclosure, an image decodingmethod performed by a decoding apparatus is provided. The methodcomprises deriving a first candidate intra prediction mode based on afirst neighboring block of a current block; deriving a second candidateintra prediction mode based on a second neighboring block of the currentblock; constructing a Most Probable Mode (MPM) list of the current blockbased on the first candidate intra prediction mode and the secondcandidate intra prediction mode; deriving an intra prediction mode forthe current block based on the MPM list; and generating a predictionsample for the current block based on the intra prediction mode, whereinthe first neighboring block is a left neighboring block located at thelowermost side among neighboring blocks adjacent to a left boundary ofthe current block, and the second neighboring block is an upperneighboring block located at the rightmost side among neighboring blocksadjacent to an upper boundary of the current block.

According to another embodiment of the present disclosure, a decodingapparatus performing image decoding is provided. The decoding apparatuscomprises a predictor deriving a first candidate intra prediction modebased on a first neighboring block of a current block, deriving a secondcandidate intra prediction mode based on a second neighboring block ofthe current block, constructing a Most Probable Mode (MPM) list of thecurrent block based on the first candidate intra prediction mode and thesecond candidate intra prediction mode, deriving an intra predictionmode for the current block based on the MPM list, and generating aprediction sample for the current block based on the intra predictionmode, wherein the first neighboring block is a left neighboring blocklocated at the lowermost side among neighboring blocks adjacent to aleft boundary of the current block, and the second neighboring block isan upper neighboring block located at the rightmost side amongneighboring blocks adjacent to an upper boundary of the current block.

According to yet another embodiment of the present disclosure, an imageencoding method performed by an encoding apparatus is provided. Themethod comprises deriving a first candidate intra prediction mode basedon a first neighboring block of a current block; deriving a secondcandidate intra prediction mode based on a second neighboring block ofthe current block; constructing a Most Probable Mode (MPM) list of thecurrent block based on the first candidate intra prediction mode and thesecond candidate intra prediction mode; determining an intra predictionmode for the current block based on the MPM list; generating aprediction sample for the current block based on the intra predictionmode; and encoding image information comprising intra prediction modeinformation for the current block, wherein the first neighboring blockis a left neighboring block located at the lowermost side amongneighboring blocks adjacent to a left boundary of the current block, andthe second neighboring block is an upper neighboring block located atthe rightmost side among neighboring blocks adjacent to an upperboundary of the current block.

According to still another embodiment of the present disclosure, animage encoding apparatus performing image encoding is provided. Theencoding apparatus comprises a predictor deriving a first candidateintra prediction mode based on a first neighboring block of a currentblock, deriving a second candidate intra prediction mode based on asecond neighboring block of the current block, constructing a MostProbable Mode (MPM) list of the current block based on the firstcandidate intra prediction mode and the second candidate intraprediction mode, determining an intra prediction mode for the currentblock based on the MPM list, and generating a prediction sample for thecurrent block based on the intra prediction mode; and an entropy encoderencoding image information comprising intra prediction mode informationfor the current block, wherein the first neighboring block is a leftneighboring block located at the lowermost side among neighboring blocksadjacent to a left boundary of the current block, and the secondneighboring block is an upper neighboring block located at the rightmostside among neighboring blocks adjacent to an upper boundary of thecurrent block.

According to still yet another embodiment of the present disclosure, adigital storage medium storing image data including encoded imageinformation generated according to an image encoding method performed byan encoding apparatus is provided.

According to still yet further embodiment of the present disclosure, adigital storage medium storing image data including encoded imageinformation that triggers the image decoding method to be performed by adecoding apparatus is provided.

According to one embodiment of the present disclosure, the overallimage/video compression efficiency may be improved.

According to one embodiment of the present disclosure, through efficientintra prediction, computational complexity may be reduced, and theoverall coding efficiency may be improved.

According to one embodiment of the present disclosure, an MPM list forthe current block may be constructed by considering the increase of thenumber of intra prediction modes, through which accuracy of the MPM listfor representing an intra prediction mode of the current block may beimproved, and the overall coding efficiency may be improved.

According to one embodiment of the present disclosure, complicatedcomputations may be reduced, and an MPM list including a plurality ofMPM candidates may be constructed based on candidate intra predictionmodes derived from neighboring blocks, through which computationalcomplexity of a process for representing an intra prediction mode of acurrent block may be reduced, and the overall coding efficiency may beimproved.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example of a video/image coding system to whichthe present disclosure may be applied.

FIG. 2 illustrates a structure of a video/image encoding apparatus towhich the present disclosure may be applied.

FIG. 3 illustrates a structure of a video/image decoding apparatus towhich the present disclosure may be applied.

FIGS. 4 a to 4 b illustrate one example of an image encoding methodperformed by a video encoding apparatus and an image decoding methodperformed by a video decoding apparatus.

FIG. 5 illustrates one example of an image encoding method based onintra prediction.

FIG. 6 illustrates one example of an image decoding method based onintra prediction.

FIG. 7 illustrates intra directional modes of 65 prediction directions.

FIG. 8 illustrates neighboring blocks of the current block.

FIGS. 9 a to 8 b illustrate one embodiment of constructing an MPM listfor a current block.

FIG. 10 illustrates one embodiment of constructing an MPM list for acurrent block.

FIGS. 11 a to 11 b illustrate one embodiment of constructing an MPM listfor a current block.

FIG. 12 illustrates one embodiment of constructing an MPM list for acurrent block.

FIG. 13 illustrates one example of constructing an MPM list.

FIGS. 14 a to 14 b illustrate one example of determining availability ofthe neighboring block B and the neighboring block D.

FIGS. 15 a to 15 b illustrate one example of determining availability ofthe neighboring block B and the neighboring block D.

FIG. 16 illustrates one example of determining neighboring intraprediction modes of the current block.

FIG. 17 illustrates one example of deriving a case for the current blockbased on the neighboring intra prediction modes.

FIGS. 18 a to 18 b illustrate one example of constructing an MPM list ofthe current block when the case for the current block is case 1.

FIGS. 19 a to 19 b illustrate one example of constructing an MPM list ofthe current block when the case for the current block is case 2.

FIG. 20 illustrates one example of constructing an MPM list of thecurrent block when the case for the current block is case 3.

FIG. 21 illustrates one example of constructing an MPM list for acurrent block.

FIG. 22 illustrates an image encoding method performed by an encodingapparatus according to the present disclosure.

FIG. 23 illustrates an encoding apparatus performing an image encodingmethod according to the present disclosure.

FIG. 24 illustrates an image decoding method performed by an imagedecoding apparatus according to the present disclosure.

FIG. 25 illustrates a decoding apparatus performing an image decodingmethod according to the present disclosure.

FIG. 26 illustrates an example of a contents streaming system to whichthe present disclosure disclosed in the present document may be applied.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

The present disclosure may be modified in various forms, and specificembodiments thereof will be described and illustrated in the drawings.However, the embodiments are not intended for limiting the disclosure.The terms used in the following description are used to merely describespecific embodiments but are not intended to limit the disclosure. Anexpression of a singular number includes an expression of the pluralnumber, so long as it is clearly read differently. The terms such as“include” and “have” are intended to indicate that features, numbers,steps, operations, elements, components, or combinations thereof used inthe following description exist and it should be thus understood thatthe possibility of existence or addition of one or more differentfeatures, numbers, steps, operations, elements, components, orcombinations thereof is not excluded.

On the other hand, elements in the drawings described in the disclosureare independently drawn for the purpose of convenience for explanationof different specific functions, and do not mean that the elements areembodied by independent hardware or independent software. For example,two or more elements of the elements may be combined to form a singleelement, or one element may be divided into plural elements. Theembodiments in which the elements are combined and/or divided belong tothe disclosure without departing from the concept of the disclosure.

Hereinafter, embodiments of the present disclosure will be described indetail with reference to the accompanying drawings. In addition, likereference numerals are used to indicate like elements throughout thedrawings, and the same descriptions on the like elements will beomitted.

FIG. 1 illustrates an example of a video/image coding system to whichthe present disclosure may be applied.

Referring to FIG. 1 , a video/image coding system may include a firstdevice (source device) and a second device (receiving device). Thesource device may deliver encoded video/image information or data in theform of a file or streaming to the receiving device via a digitalstorage medium or network.

The source device may include a video source, an encoding apparatus, anda transmitter. The receiving device may include a receiver, a decodingapparatus, and a renderer. The encoding apparatus may be called avideo/image encoding apparatus, and the decoding apparatus may be calleda video/image decoding apparatus. The transmitter may be included in theencoding apparatus. The receiver may be included in the decodingapparatus. The renderer may include a display, and the display may beconfigured as a separate device or an external component.

The video source may acquire video/image through a process of capturing,synthesizing, or generating the video/image. The video source mayinclude a video/image capture device and/or a video/image generatingdevice. The video/image capture device may include, for example, one ormore cameras, video/image archives including previously capturedvideo/images, and the like. The video/image generating device mayinclude, for example, computers, tablets and smartphones, and may(electronically) generate video/images. For example, a virtualvideo/image may be generated through a computer or the like. In thiscase, the video/image capturing process may be replaced by a process ofgenerating related data.

The encoding apparatus may encode input video/image. The encodingapparatus may perform a series of procedures such as prediction,transform, and quantization for compression and coding efficiency. Theencoded data (encoded video/image information) may be output in the formof a bitstream.

The transmitter may transmit the encoded image/image information or dataoutput in the form of a bitstream to the receiver of the receivingdevice through a digital storage medium or a network in the form of afile or streaming. The digital storage medium may include variousstorage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and thelike. The transmitter may include an element for generating a media filethrough a predetermined file format and may include an element fortransmission through a broadcast/communication network. The receiver mayreceive/extract the bitstream and transmit the received bitstream to thedecoding apparatus.

The decoding apparatus may decode the video/image by performing a seriesof procedures such as dequantization, inverse transform, and predictioncorresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The renderedvideo/image may be displayed through the display.

This document relates to video/image coding. For example, themethods/embodiments disclosed in this document may be applied to amethod disclosed in the versatile video coding (VVC), the EVC (essentialvideo coding) standard, the AOMedia Video 1 (AV1) standard, the 2ndgeneration of audio video coding standard (AVS2), or the next generationvideo/image coding standard (ex. H.267 or H.268, etc.).

This document presents various embodiments of video/image coding, andthe embodiments may be performed in combination with each other unlessotherwise mentioned.

In this document, video may refer to a series of images over time.Picture generally refers to a unit representing one image in a specifictime zone, and a slice/tile is a unit constituting part of a picture incoding. The slice/tile may include one or more coding tree units (CTUs).One picture may consist of one or more slices/tiles. One picture mayconsist of one or more tile groups. One tile group may include one ormore tiles. A brick may represent a rectangular region of CTU rowswithin a tile in a picture. A tile may be partitioned into multiplebricks, each of which consisting of one or more CTU rows within thetile. A tile that is not partitioned into multiple bricks may be alsoreferred to as a brick. A brick scan is a specific sequential orderingof CTUs partitioning a picture in which the CTUs are orderedconsecutively in CTU raster scan in a brick, bricks within a tile areordered consecutively in a raster scan of the bricks of the tile, andtiles in a picture are ordered consecutively in a raster scan of thetiles of the picture. A tile is a rectangular region of CTUs within aparticular tile column and a particular tile row in a picture. The tilecolumn is a rectangular region of CTUs having a height equal to theheight of the picture and a width specified by syntax elements in thepicture parameter set. The tile row is a rectangular region of CTUshaving a height specified by syntax elements in the picture parameterset and a width equal to the width of the picture. A tile scan is aspecific sequential ordering of CTUs partitioning a picture in which theCTUs are ordered consecutively in CTU raster scan in a tile whereastiles in a picture are ordered consecutively in a raster scan of thetiles of the picture. A slice includes an integer number of bricks of apicture that may be exclusively contained in a single NAL unit. A slicemay consist of either a number of complete tiles or only a consecutivesequence of complete bricks of one tile. Tile groups and slices may beused interchangeably in this document. For example, in this document, atile group/tile group header may be called a slice/slice header.

A pixel or a pel may mean a smallest unit constituting one picture (orimage). Also, ‘sample’ may be used as a term corresponding to a pixel. Asample may generally represent a pixel or a value of a pixel and mayrepresent only a pixel/pixel value of a luma component or only apixel/pixel value of a chroma component.

A unit may represent a basic unit of image processing. The unit mayinclude at least one of specific regions of the picture and informationrelated to the region. One unit may include one luma block and twochroma (ex. cb, cr) blocks. The unit may be used interchangeably withterms such as block or area in some cases. In a general case, an M×Nblock may include samples (or sample arrays) or a set (or array) oftransform coefficients of M columns and N rows.

In this document, the term “1” and “,” should be interpreted to indicate“and/or.” For instance, the expression “A/B” may mean “A and/or B.”Further, “A, B” may mean “A and/or B.” Further, “A/B/C” may mean “atleast one of A, B, and/or C.” Also, “A/B/C” may mean “at least one of A,B, and/or C.”

Further, in the document, the term “or” should be interpreted toindicate “and/or.” For instance, the expression “A or B” may comprise 1)only A, 2) only B, and/or 3) both A and B. In other words, the term “or”in this document should be interpreted to indicate “additionally oralternatively.”

FIG. 2 is a schematic diagram illustrating a configuration of avideo/image encoding apparatus to which the embodiment(s) of the presentdocument may be applied. Hereinafter, the video encoding apparatus mayinclude an image encoding apparatus.

Referring to FIG. 2 , the encoding apparatus 200 includes an imagepartitioner 210, a predictor 220, a residual processor 230, and anentropy encoder 240, an adder 250, a filter 260, and a memory 270. Thepredictor 220 may include an inter predictor 221 and an intra predictor222. The residual processor 230 may include a transformer 232, aquantizer 233, a dequantizer 234, and an inverse transformer 235. Theresidual processor 230 may further include a subtractor 231. The adder250 may be called a reconstructor or a reconstructed block generator.The image partitioner 210, the predictor 220, the residual processor230, the entropy encoder 240, the adder 250, and the filter 260 may beconfigured by at least one hardware component (ex. an encoder chipset orprocessor) according to an embodiment. In addition, the memory 270 mayinclude a decoded picture buffer (DPB) or may be configured by a digitalstorage medium. The hardware component may further include the memory270 as an internal/external component.

The image partitioner 210 may partition an input image (or a picture ora frame) input to the encoding apparatus 200 into one or moreprocessors. For example, the processor may be called a coding unit (CU).In this case, the coding unit may be recursively partitioned accordingto a quad-tree binary-tree ternary-tree (QTBTTT) structure from a codingtree unit (CTU) or a largest coding unit (LCU). For example, one codingunit may be partitioned into a plurality of coding units of a deeperdepth based on a quad tree structure, a binary tree structure, and/or aternary structure. In this case, for example, the quad tree structuremay be applied first, and the binary tree structure and/or ternarystructure may be applied later. Alternatively, the binary tree structuremay be applied first. The coding procedure according to this documentmay be performed based on the final coding unit that is no longerpartitioned. In this case, the largest coding unit may be used as thefinal coding unit based on coding efficiency according to imagecharacteristics, or if necessary, the coding unit may be recursivelypartitioned into coding units of deeper depth and a coding unit havingan optimal size may be used as the final coding unit. Here, the codingprocedure may include a procedure of prediction, transform, andreconstruction, which will be described later. As another example, theprocessor may further include a prediction unit (PU) or a transform unit(TU). In this case, the prediction unit and the transform unit may besplit or partitioned from the aforementioned final coding unit. Theprediction unit may be a unit of sample prediction, and the transformunit may be a unit for deriving a transform coefficient and/or a unitfor deriving a residual signal from the transform coefficient.

The unit may be used interchangeably with terms such as block or area insome cases. In a general case, an M×N block may represent a set ofsamples or transform coefficients composed of M columns and N rows. Asample may generally represent a pixel or a value of a pixel, mayrepresent only a pixel/pixel value of a luma component or represent onlya pixel/pixel value of a chroma component. A sample may be used as aterm corresponding to one picture (or image) for a pixel or a pel.

In the encoding apparatus 200, a prediction signal (predicted block,prediction sample array) output from the inter predictor 221 or theintra predictor 222 is subtracted from an input image signal (originalblock, original sample array) to generate a residual signal residualblock, residual sample array), and the generated residual signal istransmitted to the transformer 232. In this case, as shown, a unit forsubtracting a prediction signal (predicted block, prediction samplearray) from the input image signal (original block, original samplearray) in the encoder 200 may be called a subtractor 231. The predictormay perform prediction on a block to be processed (hereinafter, referredto as a current block) and generate a predicted block includingprediction samples for the current block. The predictor may determinewhether intra prediction or inter prediction is applied on a currentblock or CU basis. As described later in the description of eachprediction mode, the predictor may generate various information relatedto prediction, such as prediction mode information, and transmit thegenerated information to the entropy encoder 240. The information on theprediction may be encoded in the entropy encoder 240 and output in theform of a bitstream.

The intra predictor 222 may predict the current block by referring tothe samples in the current picture. The referred samples may be locatedin the neighborhood of the current block or may be located apartaccording to the prediction mode. In the intra prediction, predictionmodes may include a plurality of non-directional modes and a pluralityof directional modes. The non-directional mode may include, for example,a DC mode and a planar mode. The directional mode may include, forexample, 33 directional prediction modes or 65 directional predictionmodes according to the degree of detail of the prediction direction.However, this is merely an example, more or less directional predictionmodes may be used depending on a setting. The intra predictor 222 maydetermine the prediction mode applied to the current block by using aprediction mode applied to a neighboring block.

The inter predictor 221 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. Here, in order to reduce theamount of motion information transmitted in the inter prediction mode,the motion information may be predicted in units of blocks, subblocks,or samples based on correlation of motion information between theneighboring block and the current block. The motion information mayinclude a motion vector and a reference picture index. The motioninformation may further include inter prediction direction (L0prediction, L1 prediction, Bi prediction, etc.) information. In the caseof inter prediction, the neighboring block may include a spatialneighboring block present in the current picture and a temporalneighboring block present in the reference picture. The referencepicture including the reference block and the reference pictureincluding the temporal neighboring block may be the same or different.The temporal neighboring block may be called a collocated referenceblock, a co-located CU (colCU), and the like, and the reference pictureincluding the temporal neighboring block may be called a collocatedpicture (colPic). For example, the inter predictor 221 may configure amotion information candidate list based on neighboring blocks andgenerate information indicating which candidate is used to derive amotion vector and/or a reference picture index of the current block.Inter prediction may be performed based on various prediction modes. Forexample, in the case of a skip mode and a merge mode, the interpredictor 221 may use motion information of the neighboring block asmotion information of the current block. In the skip mode, unlike themerge mode, the residual signal may not be transmitted. In the case ofthe motion vector prediction (MVP) mode, the motion vector of theneighboring block may be used as a motion vector predictor and themotion vector of the current block may be indicated by signaling amotion vector difference.

The predictor 220 may generate a prediction signal based on variousprediction methods described below. For example, the predictor may notonly apply intra prediction or inter prediction to predict one block butalso simultaneously apply both intra prediction and inter prediction.This may be called combined inter and intra prediction (CIIP). Inaddition, the predictor may be based on an intra block copy (IBC)prediction mode or a palette mode for prediction of a block. The IBCprediction mode or palette mode may be used for content image/videocoding of a game or the like, for example, screen content coding (SCC).The IBC basically performs prediction in the current picture but may beperformed similarly to inter prediction in that a reference block isderived in the current picture. That is, the IBC may use at least one ofthe inter prediction techniques described in this document. The palettemode may be considered as an example of intra coding or intraprediction. When the palette mode is applied, a sample value within apicture may be signaled based on information on the palette table andthe palette index.

The prediction signal generated by the predictor (including the interpredictor 221 and/or the intra predictor 222) may be used to generate areconstructed signal or to generate a residual signal. The transformer232 may generate transform coefficients by applying a transformtechnique to the residual signal. For example, the transform techniquemay include at least one of a discrete cosine transform (DCT), adiscrete sine transform (DST), a karhunen-loeve transform (KLT), agraph-based transform (GBT), or a conditionally non-linear transform(CNT). Here, the GBT means transform obtained from a graph whenrelationship information between pixels is represented by the graph. TheCNT refers to transform generated based on a prediction signal generatedusing all previously reconstructed pixels. In addition, the transformprocess may be applied to square pixel blocks having the same size ormay be applied to blocks having a variable size rather than square.

The quantizer 233 may quantize the transform coefficients and transmitthem to the entropy encoder 240 and the entropy encoder 240 may encodethe quantized signal (information on the quantized transformcoefficients) and output a bitstream. The information on the quantizedtransform coefficients may be referred to as residual information. Thequantizer 233 may rearrange block type quantized transform coefficientsinto a one-dimensional vector form based on a coefficient scanning orderand generate information on the quantized transform coefficients basedon the quantized transform coefficients in the one-dimensional vectorform. Information on transform coefficients may be generated. Theentropy encoder 240 may perform various encoding methods such as, forexample, exponential Golomb, context-adaptive variable length coding(CAVLC), context-adaptive binary arithmetic coding (CABAC), and thelike. The entropy encoder 240 may encode information necessary forvideo/image reconstruction other than quantized transform coefficients(ex. values of syntax elements, etc.) together or separately. Encodedinformation (ex. encoded video/image information) may be transmitted orstored in units of NALs (network abstraction layer) in the form of abitstream. The video/image information may further include informationon various parameter sets such as an adaptation parameter set (APS), apicture parameter set (PPS), a sequence parameter set (SPS), or a videoparameter set (VPS). In addition, the video/image information mayfurther include general constraint information. In this document,information and/or syntax elements transmitted/signaled from theencoding apparatus to the decoding apparatus may be included invideo/picture information. The video/image information may be encodedthrough the above-described encoding procedure and included in thebitstream. The bitstream may be transmitted over a network or may bestored in a digital storage medium. The network may include abroadcasting network and/or a communication network, and the digitalstorage medium may include various storage media such as USB, SD, CD,DVD, Blu-ray, HDD, SSD, and the like. A transmitter (not shown)transmitting a signal output from the entropy encoder 240 and/or astorage (not shown) storing the signal may be included asinternal/external element of the encoding apparatus 200, andalternatively, the transmitter may be included in the entropy encoder240.

The quantized transform coefficients output from the quantizer 233 maybe used to generate a prediction signal. For example, the residualsignal (residual block or residual samples) may be reconstructed byapplying dequantization and inverse transform to the quantized transformcoefficients through the dequantizer 234 and the inverse transformer235. The adder 250 adds the reconstructed residual signal to theprediction signal output from the inter predictor 221 or the intrapredictor 222 to generate a reconstructed signal (reconstructed picture,reconstructed block, reconstructed sample array). If there is noresidual for the block to be processed, such as a case where the skipmode is applied, the predicted block may be used as the reconstructedblock. The adder 250 may be called a reconstructor or a reconstructedblock generator. The generated reconstructed signal may be used forintra prediction of a next block to be processed in the current pictureand may be used for inter prediction of a next picture through filteringas described below.

Meanwhile, luma mapping with chroma scaling (LMCS) may be applied duringpicture encoding and/or reconstruction.

The filter 260 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter260 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture and store the modifiedreconstructed picture in the memory 270, specifically, a DPB of thememory 270. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like. The filter 260 may generate variousinformation related to the filtering and transmit the generatedinformation to the entropy encoder 240 as described later in thedescription of each filtering method. The information related to thefiltering may be encoded by the entropy encoder 240 and output in theform of a bitstream.

The modified reconstructed picture transmitted to the memory 270 may beused as the reference picture in the inter predictor 221. When the interprediction is applied through the encoding apparatus, predictionmismatch between the encoding apparatus 200 and the decoding apparatusmay be avoided and encoding efficiency may be improved.

The DPB of the memory 270 DPB may store the modified reconstructedpicture for use as a reference picture in the inter predictor 221. Thememory 270 may store the motion information of the block from which themotion information in the current picture is derived (or encoded) and/orthe motion information of the blocks in the picture that have alreadybeen reconstructed. The stored motion information may be transmitted tothe inter predictor 221 and used as the motion information of thespatial neighboring block or the motion information of the temporalneighboring block. The memory 270 may store reconstructed samples ofreconstructed blocks in the current picture and may transfer thereconstructed samples to the intra predictor 222.

FIG. 3 is a schematic diagram illustrating a configuration of avideo/image decoding apparatus to which the embodiment(s) of the presentdocument may be applied.

Referring to FIG. 3 , the decoding apparatus 300 may include an entropydecoder 310, a residual processor 320, a predictor 330, an adder 340, afilter 350, a memory 360. The predictor 330 may include an interpredictor 331 and an intra predictor 332. The residual processor 320 mayinclude a dequantizer 321 and an inverse transformer 321. The entropydecoder 310, the residual processor 320, the predictor 330, the adder340, and the filter 350 may be configured by a hardware component (ex. adecoder chipset or a processor) according to an embodiment. In addition,the memory 360 may include a decoded picture buffer (DPB) or may beconfigured by a digital storage medium. The hardware component mayfurther include the memory 360 as an internal/external component.

When a bitstream including video/image information is input, thedecoding apparatus 300 may reconstruct an image corresponding to aprocess in which the video/image information is processed in theencoding apparatus of FIG. 2 . For example, the decoding apparatus 300may derive units/blocks based on block partition related informationobtained from the bitstream. The decoding apparatus 300 may performdecoding using a processor applied in the encoding apparatus. Thus, theprocessor of decoding may be a coding unit, for example, and the codingunit may be partitioned according to a quad tree structure, binary treestructure and/or ternary tree structure from the coding tree unit or thelargest coding unit. One or more transform units may be derived from thecoding unit. The reconstructed image signal decoded and output throughthe decoding apparatus 300 may be reproduced through a reproducingapparatus.

The decoding apparatus 300 may receive a signal output from the encodingapparatus of FIG. 2 in the form of a bitstream, and the received signalmay be decoded through the entropy decoder 310. For example, the entropydecoder 310 may parse the bitstream to derive information (ex.video/image information) necessary for image reconstruction (or picturereconstruction). The video/image information may further includeinformation on various parameter sets such as an adaptation parameterset (APS), a picture parameter set (PPS), a sequence parameter set(SPS), or a video parameter set (VPS). In addition, the video/imageinformation may further include general constraint information. Thedecoding apparatus may further decode picture based on the informationon the parameter set and/or the general constraint information.Signaled/received information and/or syntax elements described later inthis document may be decoded may decode the decoding procedure andobtained from the bitstream. For example, the entropy decoder 310decodes the information in the bitstream based on a coding method suchas exponential Golomb coding, CAVLC, or CABAC, and output syntaxelements required for image reconstruction and quantized values oftransform coefficients for residual. More specifically, the CABACentropy decoding method may receive a bin corresponding to each syntaxelement in the bitstream, determine a context model using a decodingtarget syntax element information, decoding information of a decodingtarget block or information of a symbol/bin decoded in a previous stage,and perform an arithmetic decoding on the bin by predicting aprobability of occurrence of a bin according to the determined contextmodel, and generate a symbol corresponding to the value of each syntaxelement. In this case, the CABAC entropy decoding method may update thecontext model by using the information of the decoded symbol/bin for acontext model of a next symbol/bin after determining the context model.The information related to the prediction among the information decodedby the entropy decoder 310 may be provided to the predictor (the interpredictor 332 and the intra predictor 331), and the residual value onwhich the entropy decoding was performed in the entropy decoder 310,that is, the quantized transform coefficients and related parameterinformation, may be input to the residual processor 320. The residualprocessor 320 may derive the residual signal (the residual block, theresidual samples, the residual sample array). In addition, informationon filtering among information decoded by the entropy decoder 310 may beprovided to the filter 350. Meanwhile, a receiver (not shown) forreceiving a signal output from the encoding apparatus may be furtherconfigured as an internal/external element of the decoding apparatus300, or the receiver may be a component of the entropy decoder 310.Meanwhile, the decoding apparatus according to this document may bereferred to as a video/image/picture decoding apparatus, and thedecoding apparatus may be classified into an information decoder(video/image/picture information decoder) and a sample decoder(video/image/picture sample decoder). The information decoder mayinclude the entropy decoder 310, and the sample decoder may include atleast one of the dequantizer 321, the inverse transformer 322, the adder340, the filter 350, the memory 360, the inter predictor 332, and theintra predictor 331.

The dequantizer 321 may dequantize the quantized transform coefficientsand output the transform coefficients. The dequantizer 321 may rearrangethe quantized transform coefficients in the form of a two-dimensionalblock form. In this case, the rearrangement may be performed based onthe coefficient scanning order performed in the encoding apparatus. Thedequantizer 321 may perform dequantization on the quantized transformcoefficients by using a quantization parameter (ex. quantization stepsize information) and obtain transform coefficients.

The inverse transformer 322 inversely transforms the transformcoefficients to obtain a residual signal (residual block, residualsample array).

The predictor may perform prediction on the current block and generate apredicted block including prediction samples for the current block. Thepredictor may determine whether intra prediction or inter prediction isapplied to the current block based on the information on the predictionoutput from the entropy decoder 310 and may determine a specificintra/inter prediction mode.

The predictor 320 may generate a prediction signal based on variousprediction methods described below. For example, the predictor may notonly apply intra prediction or inter prediction to predict one block butalso simultaneously apply intra prediction and inter prediction. Thismay be called combined inter and intra prediction (CIIP). In addition,the predictor may be based on an intra block copy (IBC) prediction modeor a palette mode for prediction of a block. The IBC prediction mode orpalette mode may be used for content image/video coding of a game or thelike, for example, screen content coding (SCC). The IBC basicallyperforms prediction in the current picture but may be performedsimilarly to inter prediction in that a reference block is derived inthe current picture. That is, the IBC may use at least one of the interprediction techniques described in this document. The palette mode maybe considered as an example of intra coding or intra prediction. Whenthe palette mode is applied, a sample value within a picture may besignaled based on information on the palette table and the paletteindex.

The intra predictor 331 may predict the current block by referring tothe samples in the current picture. The referred samples may be locatedin the neighborhood of the current block or may be located apartaccording to the prediction mode. In the intra prediction, predictionmodes may include a plurality of non-directional modes and a pluralityof directional modes. The intra predictor 331 may determine theprediction mode applied to the current block by using a prediction modeapplied to a neighboring block.

The inter predictor 332 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. In this case, in order to reducethe amount of motion information transmitted in the inter predictionmode, motion information may be predicted in units of blocks, subblocks,or samples based on correlation of motion information between theneighboring block and the current block. The motion information mayinclude a motion vector and a reference picture index. The motioninformation may further include inter prediction direction (L0prediction, L1 prediction, Bi prediction, etc.) information. In the caseof inter prediction, the neighboring block may include a spatialneighboring block present in the current picture and a temporalneighboring block present in the reference picture. For example, theinter predictor 332 may configure a motion information candidate listbased on neighboring blocks and derive a motion vector of the currentblock and/or a reference picture index based on the received candidateselection information. Inter prediction may be performed based onvarious prediction modes, and the information on the prediction mayinclude information indicating a mode of inter prediction for thecurrent block.

The adder 340 may generate a reconstructed signal (reconstructedpicture, reconstructed block, reconstructed sample array) by adding theobtained residual signal to the prediction signal (predicted block,predicted sample array) output from the predictor (including the interpredictor 332 and/or the intra predictor 331). If there is no residualfor the block to be processed, such as when the skip mode is applied,the predicted block may be used as the reconstructed block.

The adder 340 may be called reconstructor or a reconstructed blockgenerator. The generated reconstructed signal may be used for intraprediction of a next block to be processed in the current picture, maybe output through filtering as described below, or may be used for interprediction of a next picture.

Meanwhile, luma mapping with chroma scaling (LMCS) may be applied in thepicture decoding process.

The filter 350 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter350 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture and store the modifiedreconstructed picture in the memory 360, specifically, a DPB of thememory 360. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like.

The (modified) reconstructed picture stored in the DPB of the memory 360may be used as a reference picture in the inter predictor 332. Thememory 360 may store the motion information of the block from which themotion information in the current picture is derived (or decoded) and/orthe motion information of the blocks in the picture that have alreadybeen reconstructed. The stored motion information may be transmitted tothe inter predictor 260 so as to be utilized as the motion informationof the spatial neighboring block or the motion information of thetemporal neighboring block. The memory 360 may store reconstructedsamples of reconstructed blocks in the current picture and transfer thereconstructed samples to the intra predictor 331.

In the present disclosure, the embodiments described in the filter 260,the inter predictor 221, and the intra predictor 222 of the encodingapparatus 200 may be the same as or respectively applied to correspondto the filter 350, the inter predictor 332, and the intra predictor 331of the decoding apparatus 300.

As described above, in performing video coding, prediction is performedto increase compression efficiency. By doing so, a prediction blockincluding prediction samples for a current block, which is a codingtarget block, may be generated. Here, the prediction block includesprediction samples in the spatial domain (or pixel domain). Theprediction block is derived in both of the encoding and decodingapparatus, where the encoding apparatus may increase image codingefficiency by signaling information about residuals (residualinformation) between an original block and the prediction block, ratherthan original sample values of the original block, to the decodingapparatus. The decoding apparatus may derive a residual block includingresidual samples based on the residual information, generate areconstructed block including reconstructed samples by combining theresidual block and the prediction block, and generate a reconstructedpicture including reconstructed blocks.

The residual information may be generated through a transform andquantization processes. For example, the encoding apparatus may derive aresidual block between the original block and the prediction block,derive transform coefficients by performing the transform process toresidual samples (residual sample array) included in the residual block,derive quantized transform coefficients by performing the quantizationprocess on the transform coefficients, and signal related residualinformation to the decoding apparatus (through a bitstream). Here, theresidual information may include information about the values of thequantized transform coefficients, position information, transformtechnique, transform kernel, and quantization parameters. The decodingapparatus may perform a dequantization/inverse-transform process basedon the residual information and derive residual samples (or residualblock). The decoding apparatus may generate a reconstructed picturebased on a prediction block and the residual block.

Meanwhile, if the intra prediction is performed, correlation amongsamples may be utilized, and a difference between an original block anda prediction block, namely, residuals may be obtained. The transform andquantization processes may be applied to the residuals, through whichspatial redundancy may be removed. More specifically, an encoding anddecoding methods employing intra prediction may be described as follows.

FIG. 4 illustrates one example of an image encoding method performed bya video encoding apparatus and an image decoding method performed by avideo decoding apparatus.

FIG. 4 a illustrates one example of an image encoding method performedby a video encoding apparatus. Referring to FIG. 4 a , the imageencoding method may include a block partitioning process, an intra/interprediction process, a transform process, a quantization process, and anentropy encoding process. For example, a current picture may be splitinto a plurality of blocks, a prediction block of a current block may begenerated through intra/inter prediction, and a residual block of thecurrent block may be generated through subtraction between an inputblock of the current block and the prediction block. Afterwards, acoefficient block, namely transform coefficients of the current blockmay be generated through transform of the residual block. The transformcoefficients may be quantized, entropy-encoded, and then stored in abitstream.

FIG. 4 b illustrates one example of an image decoding method performedby a decoding apparatus. Referring to FIG. 4 b , the image decodingmethod may include an entropy decoding process, a dequantizationprocess, an inverse transform process, and an intra/inter predictionprocess. More specifically, quantized transform coefficients may beobtained through entropy decoding of a bitstream, and a coefficientblock of a current block, namely transform coefficients may be obtainedthrough dequantization of the quantized transform coefficients. Aresidual block of the current block may be derived through inversetransform of the transform coefficients, and a reconstructed block ofthe current block may be derived through addition of a prediction blockof the current block derived through intra/inter prediction and theresidual block.

FIG. 5 illustrates one example of an intra prediction-based imageencoding method. Referring to FIG. 5 , an encoding apparatus may derivean intra prediction mode for a current block S500 and derive neighboringreference samples of the current block S510. The encoding apparatus maydetermine a bit rate for the current block and the optimal intraprediction mode in which distortion is minimized. The encoding apparatusmay generate prediction samples within the current block based on theintra prediction mode and the neighboring reference samples S520. Inthis case, the encoding apparatus may perform a prediction samplefiltering process S530. Prediction sample filtering may be calledpost-filtering. According to the prediction sample filtering process,all or part of the prediction samples may be filtered. Depending onsituations, the S530 step may be omitted.

The encoding apparatus may generate residual samples for the currentblock based on (filtered) prediction samples S540. The encodingapparatus may encode prediction mode information representing the intraprediction mode and image information including residual informationabout the residual samples S550. The encoded image information may beoutput in the form of a bitstream. The output bitstream may be providedto a decoding apparatus via a storage medium or a network.

FIG. 6 illustrates one example of an intra prediction-based imagedecoding method. Referring to FIG. 6 , a decoding apparatus may performoperations corresponding to the operations performed by the encodingapparatus. For example, the decoding apparatus may derive an intraprediction mode for a current block based on received prediction modeinformation S600. The decoding apparatus may derive neighboringreference samples of the current block S610. The decoding apparatus maygenerate prediction samples within the current block based on the intraprediction mode and the neighboring reference samples S620. In thiscase, the decoding apparatus may perform a prediction sample filteringprocess S630. Prediction sample filtering may be called post-filtering.All or part of the prediction samples may be filtered according to theprediction sample filtering process. Depending on situations, the S630step may be omitted.

The decoding apparatus may generate residual samples for the currentblock based on received residual information S640. The decodingapparatus may generate reconstructed samples for the current block basedon the (filtered) prediction samples and the residual samples; andgenerate a reconstructed picture based on the reconstructed samplesS650.

Meanwhile, if intra prediction is applied to the current block, asdescribed above, the encoding apparatus/decoding apparatus may derive anintra prediction mode for the current block and derive a predictionsample of the current block based on the intra prediction mode. In otherwords, the encoding apparatus/decoding apparatus may derive theprediction sample of the current block by applying a directional mode ora non-directional mode based on neighboring reference samples of thecurrent block.

For example, the intra prediction mode may include 2 non-directional ornon-angular intra prediction modes and 65 directional or angular intraprediction modes. The non-directional intra prediction modes may includea planar intra prediction mode of 0 and a DC intra prediction mode of 1while the directional intra prediction modes may include 65 intraprediction modes of 2 to 66. However, it should be noted that thisparticular configuration is only an example, and the present disclosuremay also be applied to other case where the number of intra predictionmodes is different from that of the current example. Meanwhile,depending on situations, an intra prediction mode of 67 may be furtherincluded, where the 67 intra prediction mode may represent a linearmodel (LM) mode.

FIG. 7 illustrates intra directional modes of 65 prediction directions.

Referring to FIG. 7 , intra prediction modes having horizontaldirectionality and intra prediction modes having vertical directionalitymay be distinguished from each other with reference to the intraprediction mode 34 along the top-left diagonal prediction direction. Hand V of FIG. 7 represent the horizontal and vertical directionality,respectively, and the number ranging from −32 to 32 represents angularpositions in units of 1/32 on the sample grids. The intra predictionmodes 2 to 33 have horizontal directionality while the intra predictionmodes 34 to 66 have vertical directionality. The intra prediction mode18 and the intra prediction mode 50 represent the horizontal intraprediction mode and the vertical intra prediction mode, respectively;the intra prediction mode 2 may be referred to as the lower-leftdiagonal intra prediction mode, the intra prediction mode 34 as theupper-left diagonal intra prediction mode, and the intra prediction mode66 as the upper-right diagonal intra prediction mode.

Meanwhile, if the intra prediction is applied to the current block, anintra prediction mode may be derived, which is applied to the currentblock based on the intra prediction mode of neighboring blocks of thecurrent block. For example, the decoding apparatus may derive a MostProbable Mode (MPM) list based on the intra prediction modes ofneighboring blocks (for example, a left neighboring block and/or anupper neighboring block) of a current block and additional candidatemodes, may select, based on a received MPM index, one among MPMcandidates within the derived MPM list, or may select, based on theremaining intra prediction mode information, one among the remainingintra prediction modes not included in the MPM candidates. The MPM listmay be referred to as an intra prediction mode candidate list or may betermed as candModeList.

Here, for example, the MPM list may include 3 MPM candidates, 5candidates, or 6 MPM candidates. As one example, the MPM list mayinclude an intra prediction mode of a neighboring block, a derived intraprediction mode and/or candidates derived based on a default intraprediction mode. The encoding apparatus/decoding apparatus may searchfor neighboring blocks of a current block according to a specific orderand derive an intra prediction mode of the neighboring block as the MPMcandidate according to a derived order. For example, the neighboringblocks may include a left neighboring block, an upper neighboring block,a lower-left neighboring block, an upper-right neighboring block, and anupper-left neighboring block.

For example, in the HEVC standard, an MPM list comprising 3 MPMcandidates may be constructed, where the 3 MPM candidates may be derivedbased on the intra prediction modes of a neighboring block F and aneighboring block G. The neighboring blocks of the current blockincluding the neighboring block F and the neighboring block G may be thesame as described below.

FIG. 8 illustrates neighboring blocks of the current block. Referring toFIG. 8 , neighboring blocks of the current block may include aneighboring block A, neighboring block B, neighboring block C,neighboring block D, neighboring block E, neighboring block F and/orneighboring block G.

Here, the neighboring block A may represent a neighboring block locatedat the top-left of the top-left sample position of the current block,the neighboring block B may represent a neighboring block located at theupper of the top-right sample position of the current block, theneighboring block C may represent a neighboring block located at thetop-right of the top-right sample position of the current block, theneighboring block D may represent a neighboring block located at theleft of the lower-left sample position of the current block, theneighboring block E may represent a neighboring block located at thelower left of the lower-left sample position of the current block, theneighboring block G may represent a neighboring block located at theupper of the top-left sample position of the current block, and theneighboring block F may represent a neighboring block located at theleft of the top-left sample position of the current block.

For example, if the size of the current block is W×H, x component of thetop-left sample position of the current block is 0, and y componentthereof is 0, the neighboring block A may be a block containing a sampleat the coordinates of (−1, −1), the neighboring block B may be a blockcontaining a sample at the coordinates of (W−1, −1), the neighboringblock C is a block containing a sample at the coordinates of (W, −1),the neighboring block D is a block containing a sample at thecoordinates of (−1, H−1), the neighboring block E is a block containinga sample at the coordinates of (−1, H−1), the neighboring block F is ablock containing a sample at the coordinates of (−1, 0), and theneighboring block G is a block containing a sample at the coordinates of(0, −1).

According to the HEVC standard, 3 MPM candidates may be derived based onthe intra prediction mode of the neighboring block F and the intraprediction mode of the neighboring block G. For example, the intraprediction mode of the neighboring block F and the intra prediction modeof the neighboring block G may be derived. Meanwhile, for the followingcases, the intra prediction mode of the neighboring block F or the intraprediction mode of the neighboring block G may be derived as a DC intraprediction mode:

1) The case where the neighboring block F or the neighboring block G isunavailable,

2) The case where the neighboring block F or the neighboring block G isnot coded in an intra prediction mode (the case where the neighboringblock F or the neighboring block G is not an intra coded block), or

3) The case where the neighboring block F or the neighboring block Gleaves a current coding tree unit.

If the intra prediction mode of the neighboring block F or the intraprediction mode of the neighboring block G is determined, the three MPMcandidates may be derived as shown in the table below.

TABLE 1 if (intra mode of F and G are equal) {  if (intra mode of F <intra mode 2)  { MPM list1 }  else  { MPM Iist2 } } else {  if (Neitherintra mode of F nor G are intra mode Planar)  { MPM Iist3 }  else if(intra mode of (F+G) <intra mode 2)  { MPM Iist4 }  else  { MPM Iist5 }}

Table 1 represents pseudo code for constructing the MPM list.

Referring to Table 1, it may be determined whether the intra predictionmode of the neighboring block F is the same as the intra prediction modeof the neighboring block G.

If the intra prediction mode of the neighboring block F is the same asthe intra prediction mode of the neighboring block G, and the modenumber of the intra prediction mode of the neighboring block F issmaller than 2, the MPM list of the current block may be derived as MPMlist 1. In other words, if the intra prediction mode of the neighboringblock F is the same as the intra prediction mode of the neighboringblock G, and the intra prediction mode of the neighboring block F isintra prediction mode 0 or intra prediction mode 1, the MPM list of thecurrent block may be derived as MPM list 1.

Also, if the intra prediction mode of the neighboring block F is thesame as the intra prediction mode of the neighboring block G, and themode number of the intra prediction mode of the neighboring block F isnot smaller than 2, the MPM list of the current block may be derived asMPM list 2.

Also, if the intra prediction mode of the neighboring block F is not thesame as the intra prediction mode of the neighboring block G, and theintra prediction mode of the neighboring block F and the intraprediction mode of the neighboring block G are not the planar intraprediction mode, the MPM list of the current block may be derived as MPMlist 3.

Also, if the intra prediction mode of the neighboring block F is not thesame as the intra prediction mode of the neighboring block G, and a sumof the mode number of the intra prediction mode of the neighboring blockF, the intra prediction mode of the neighboring block G, and the modenumber of the planar intra prediction mode is smaller than 2, the MPMlist of the current block may be derived as MPM list 4.

Also, if the intra prediction mode of the neighboring block F is not thesame as the intra prediction mode of the neighboring block G, at leastone of the intra prediction mode of the neighboring block F and theintra prediction mode of the neighboring block G is a planar intraprediction mode, and a sum of the mode number of the intra predictionmode of the neighboring block F, the intra prediction mode of theneighboring block G, and the mode number of the planar intra predictionmode is not smaller than 2, the MPM list of the current block may bederived as MPM list 5.

Meanwhile, with the increase of the number of intra prediction modes,the number of MPM candidates needs to be increased. Accordingly, thenumber of MPM candidates may vary according to the number of intraprediction modes. For most cases, if the number of intra predictionmodes is increased, the number of MPM candidates may be increased.However, the increase of the number of intra prediction modes does notalways lead to an increase of the number of MPM candidates. For example,in the existence of 35 intra prediction modes or in the existence of 67intra prediction modes, a various number of MPM candidates may beobtained, such as 3, 4, 5, or 6 depending on the design.

For example, construction of a 6 MPM list may be performed. In otherwords, an MPM list including the 6 MPM candidates may be constructed.For example, during construction of the 6 MPM list, a process ofsearching for positions of various neighboring blocks and a continuouspruning check process for excluding the same intra prediction mode maybe performed. As one example, configuration of 6 MPM candidates may beperformed in the following order:

Neighboring block D, neighboring block B, planar intra prediction mode,DC intra prediction mode, neighboring block E, neighboring block C, andneighboring block A.

In other words, an intra prediction mode may be derived as an MPMcandidate in the order of the intra prediction mode of the neighboringblock D, intra prediction mode of the neighboring block B, planar intraprediction mode, DC intra prediction mode, intra prediction mode of theneighboring block E, intra prediction mode of the neighboring block C,and intra prediction mode of the neighboring block A; and if an intraprediction mode is the same as the intra prediction mode alreadyderived, it may not be derived as an MPM candidate.

Also, if an MPM list does not include the maximum number of MPMcandidates, namely, if the number of derived MPM candidates is smallerthan the maximum number of candidates, a directional intra predictionmode adjacent to a derived MPM candidate and a predefined default intraprediction mode may be considered as MPM candidates, and the pruningcheck process may be performed together. Here, the directional intraprediction mode adjacent to the MPM candidate may indicate an intraprediction mode the mode number of which is adjacent to the MPMcandidate. Although the search of neighboring blocks and continuouspruning check described above is advantageous in saving bit transferrate, it may increase the hardware operation frequency for constructingan MPM list of each block. The worst scenario may be the case where a3840×2160 4K image is split into 4×4 sized blocks for intra prediction,where the increased hardware operating frequency for each 4×4 sizedblock may be considered to be important in terms of throughput.Meanwhile, if a neighboring block coded by inter prediction of thecurrent block knows the intra prediction mode of the neighboring block,the intra prediction mode of the neighboring block may be used forconstruction of an MPM list.

As described above, a current block to be coded and its neighboringblocks usually have similar image characteristics, and since the currentblock and its neighboring blocks have a high probability of having thesame or similar intra prediction mode, an MPM list of the current blockmay be determined to derive an intra prediction mode applied to thecurrent block. However, if 67 intra prediction modes are used for intraprediction, an MPM list including existing three MPM candidates may notbe sufficient to represent the diversity of a plurality of intraprediction modes. Also, a method for constructing the 6 MPM listincluding the search process for neighboring blocks and pruning checkprocess is so complicated that the method may impact throughput.Therefore, as described in the embodiments below, the present disclosureproposes an efficient method for constructing an MPM list thatappropriately trades off complexity for coding efficiency.

FIG. 9 illustrates one embodiment of constructing an MPM list for acurrent block.

Referring to FIG. 9 , an MPM list for the current block, including k MPMcandidates, may be constructed. k shown in FIG. 9 may represent thelength of the MPM list, namely, the number of MPM candidates included inthe MPM list. According to one embodiment of FIG. 9 , one among 5efficient MPM lists may be constructed based on four conditions. Inother words, referring to FIG. 9 , one of 5 MPM lists may be derived asan MPM list for the current block based on four conditions. As shown inFIG. 9 a , the MPM lists may be independent lists, or as shown in FIG. 9b , the MPM lists may have a portion partially shared among them. Asshown in FIG. 9 b , if the shared portion of the lists is used, aduplication process may be avoided. The conditions may be modeled sothat the sum of probabilities of all of the conditions is equal to 1.

FIG. 10 illustrates one embodiment of constructing an MPM list for acurrent block.

FIG. 10 illustrates one embodiment of efficiently constructing an MPMlist for the current block including k MPM candidates based onneighboring blocks of the current block. For example, k may be 6, and 4conditions may be used to construct an MPM list for the current blockamong 5 efficient lists. Meanwhile, referring to FIG. 10 , L mayrepresent an intra prediction mode of the neighboring block B, and A mayrepresent an intra prediction mode of the neighboring block D. Or,referring to FIG. 10 , L may represent an intra prediction mode of theneighboring block D, and A may represent an intra prediction mode of theneighboring block B.

More specifically, for example, referring to FIG. 10 , the encodingapparatus/decoding apparatus may check condition 1 indicating that the Lis the same as the A S1000. In other words, the encodingapparatus/decoding apparatus may determine whether the L is the same asthe A.

If the L is the same as the A, the encoding apparatus/decoding apparatusmay check condition 2 indicating that the L is the same as the A, andthe L and the A are directional intra prediction modes S1010. In otherwords, if the L is the same as the A, the encoding apparatus/decodingapparatus may determine whether the mode number of the L is larger thanthe mode number of the DC intra prediction mode. If the second conditionis satisfied, MPM list 1 may be derived as an MPM list for the currentblock while, if the second condition is not satisfied, MPM list 2 may bederived as an MPM list for the current block.

Meanwhile, if the L is not the same as the A, the encodingapparatus/decoding apparatus may derive a shared list S1020 and performthe next step S1030. The shared list may be derived as part of the MPMlist for the current block.

The shared list may be derived as shown in the table below.

TABLE 2 mpm[0] = L mpm[1] = A

Referring to Table 2, the shared list may include a first MPM candidaterepresenting the L and a second MPM candidate representing the A. Inother words, if the L is not the same as the A, the encodingapparatus/decoding apparatus may derive the L as the first MPM candidateand derive the A as the second MPM candidate. Referring to Table 2,mpm[0] may represent the first MPM candidate, and mpm[1] may representthe second MPM candidate. The shared list may represent a portion sharedby MPM list 3, MPM list 4, and MPM list 5. If the value of an MPM indexis 0, the first MPM candidate may represent an MPM candidate indicatedby the MPM index, and if the value of the MPM index is 1, the second MPMcandidate may represent an MPM candidate indicated by the MPM index.

Afterwards, the encoding apparatus/decoding apparatus may check thethird condition S1030. The third condition may indicate whether a sum ofthe mode number of the L and the mode number of the A is the same as themode number of the DC intra prediction mode. If the third condition issatisfied, namely, if a sum of the mode number of the L and the modenumber of the A is the same as the mode number of the DC intraprediction mode, the encoding apparatus/decoding apparatus may derivethe remaining portion of MPM list 3. In other words, the encodingapparatus/decoding apparatus may derive the MPM list 3 as an MPM listfor the current block.

If the third condition is not satisfied, the encoding apparatus/decodingapparatus may check the fourth condition S1040. The fourth condition mayindicate whether the mode number of the L is smaller than or equal tothe mode number of the DC intra prediction mode, or the mode number ofthe A is smaller than or equal to the mode number of the DC intraprediction mode. In other words, the fourth condition may indicatewhether at least one of the L and the A is the planar intra predictionmode and/or DC intra prediction mode. The fourth condition may indicatewhether one of the L and the A is the planar intra prediction modeand/or DC intra prediction mode and whether one of the two is adirectional intra prediction mode. If the fourth condition is satisfied,the encoding apparatus/decoding apparatus may derive the remainingportion of the MPM list 4. In other words, the encodingapparatus/decoding apparatus may derive the MPM list 4 as an MPM listfor the current block. Meanwhile, if the fourth condition is notsatisfied, the encoding apparatus/decoding apparatus may derive theremaining portion of the MPM list 5. In other words, the encodingapparatus/decoding apparatus may derive the MPM list 5 as an MPM listfor the current block.

Meanwhile, the MPM list 1 may be derived as shown in the followingtable.

TABLE 3 mpm[0] = L mpm[1] = L−1 mpm[2] = L+1 mpm[3] = L−2 mpm[4] =Planar_idx mpm[5] = DC_idx

The MPM list 1 may include a first MPM candidate representing L, asecond MPM candidate representing L−1, a third MPM candidaterepresenting L+1, a fourth MPM candidate representing L−2, a fifth MPMcandidate representing a planar intra prediction mode, and a sixth MPMcandidate representing a DC intra prediction mode. If the L is the N-thintra prediction mode, L−1 may represent the (N−1)-th intra predictionmode, L+1 may represent the (N+1)-th intra prediction mode, and L−2 mayrepresent the (N−2)-th intra prediction mode.

Also, the MPM list 2 may be derived as shown in the table below.

TABLE 4 mpm[0] = Planar_idx mpm[1] = DC_idx mpm[2] = Vertical_idx mpm[3]= Horizontal_idx mpm[4] = Horizontal_Diagonal_idx mpm[5] =Vertical_Diagonal_idx

The MPM list 2 may include a first MPM candidate representing a planarintra prediction mode, a second MPM candidate representing a DC intraprediction mode, a third MPM candidate representing a vertical intraprediction mode, a fourth MPM candidate representing a horizontal intraprediction mode, a fifth MPM candidate representing a horizontaldiagonal intra prediction mode, and a sixth MPM candidate representing avertical diagonal intra prediction mode.

Also, the rest of the MPM list 3 may be derived as shown in the tablebelow.

TABLE 5 mpm[2] = Vertical_idx mpm[3] = Horizontal_idx mpm[4] =Horizontal_Diagonal_idx mpm[5] = Vertical_Diagonal_idx

Table 5 may represent the rest of the MPM list 3 except for the sharedlist. The MPM list 3 may include a third MPM candidate representing avertical intra prediction mode, a fourth MPM candidate representing ahorizontal intra prediction mode, a fifth MPM candidate representing ahorizontal diagonal intra prediction mode, and a sixth MPM candidaterepresenting a vertical diagonal intra prediction mode.

Also, the rest of the MPM list 4 may be derived as shown in the tablebelow.

TABLE 6 mpm[2] = (Min (L, A) == Planar_idx) ? DC_idx : Planar_idx mpm[3]= Max (L, A)−1 mpm[4] = Max (L, A)+1 mpm[5] = Max (L, A)−2

Table 6 may represent the rest of the MPM list 4 except for the sharedlist. Referring to FIG. 6 , if the smaller of the mode numbers of the Land the A is the same as the mode number of a planar intra predictionmode, the third MPM candidate of the MPM list 4 may be derived as a DCintra prediction mode; if the smaller of the mode numbers of the L andthe A is not the same as the mode number of the planar intra predictionmode, the third MPM candidate of the MPM list 4 may be derived as theplanar intra prediction mode. Also, the fourth MPM candidate of the MPMlist 4 may be derived as an intra prediction mode having a valueobtained by subtracting 1 from the larger of the mode numbers of the Land the A; the fifth MPM candidate of the MPM list 4 may be derived asan intra prediction mode having a value obtained by adding 1 to thelarger of the mode numbers of the L and the A; and the sixth MPMcandidate of the MPM list 4 may be derived as an intra prediction modehaving a value obtained by subtracting 2 from the larger of the modenumbers of the L and the A.

Also, the rest of the MPM list 5 may be derives as shown in the tablebelow.

TABLE 7 mpm[2] = Planar_idx mpm[3] = DC_idx If (L−1 mode is not includedin the current MPM list)  Add L−1 mode into the MPM list If (L+1 mode isnot included in the current MPM list)  Add L+1 mode into the MPM list If(A−1 mode is not included in the current MPM list)  Add A−1 mode intothe MPM list  If length of MPM list is equal to 6, stop MPM listgeneration process If (A+1 mode is not included in the current MPM list) Add A+1 mode into the MPM list If length of MPM list is equal to 6,stop MPM list generation process

Table 7 may represent the rest of the MPM list 5 except for the sharedlist. Referring to Table 7, the third MPM candidate of the MPM list 5may be derived as a planar intra prediction mode, and the fourth MPMcandidate of the MPM list 5 may be derived as a DC intra predictionmode. Afterwards, if L−1 is not included in the MPM list for the currentblock, the L−1 may be added to the MPM list of the current block as anMPM candidate. Afterwards, it may be determined whether L+1 is includedin the MPM list for the current block, and if the L+1 is not included inthe MPM list for the current block, the L+1 may be added to the MPM listof the current block as an MPM candidate.

Afterwards, it may be determined whether A−1 is included in the MPM listfor the current block, and if the A−1 is not included in the MPM listfor the current block, the A−1 may be added to the MPM list of thecurrent block as an MPM candidate. Afterwards, if the length of the MPMlist for the current block is 6, namely, if the number of MPM candidatesincluded in the MPM list is 6, the MPM list generation process may bestopped.

If the number of MPM candidates included in the MPM list is smaller than6, it may be determined whether A+1 is included in the MPM list for thecurrent block, and if the A+1 is not included in the MPM list for thecurrent block, the A+1 may be added to the MPM list for the currentblock as an MPM candidate. Afterwards, if the length of the MPM list forthe current block is 6, namely, if the number of MPM candidates includedin the MPM list is 6, the MPM list generation process may be stopped.

FIGS. 11 a to 11 b illustrate one embodiment of constructing an MPM listfor a current block.

Referring to FIG. 11 , an MPM list for the current block, including kMPM candidates, may be constructed. k disclosed in FIG. 11 may representthe length of an MPM list, namely, the number of MPM candidates includedin the MPM list. The embodiment of FIG. 11 may illustrate a method forconstructing an MPM list in a simpler way than the embodiment shown inFIG. 9 . For example, according to the embodiment of FIG. 11 , one ofthree efficient MPM lists may be constructed based on two conditions. Asshown in FIG. 11 a , the MPM lists may be independent lists, or as shownin FIG. 11 b , the MPM lists may have a portion partially shared amongthem. As shown in FIG. 11 b , if the shared portion of the lists isused, a duplication process may be avoided. The conditions may bemodeled so that the sum of probabilities of all of the conditions isequal to 1.

FIG. 12 illustrates one embodiment of constructing an MPM list for acurrent block.

FIG. 12 illustrates one embodiment of efficiently constructing an MPMlist for the current block including k MPM candidates based onneighboring blocks of the current block. For example, k may be 6, and 2conditions may be used to construct an MPM list for the current blockamong 3 efficient lists. Meanwhile, referring to FIG. 12 , L mayrepresent an intra prediction mode of the neighboring block B, and A mayrepresent an intra prediction mode of the neighboring block D. Or,referring to FIG. 12 , L may represent an intra prediction mode of theneighboring block D, and A may represent an intra prediction mode of theneighboring block B.

Referring to FIG. 12 , the encoding apparatus/decoding apparatus maycheck condition 5 that indicates whether the L or the A is a planarintra prediction mode and a DC intra prediction mode S1200. In otherwords, the encoding apparatus/decoding apparatus may determine whetherthe L or the A is the planar intra prediction mode and the DC intraprediction mode. For example, the encoding apparatus/decoding apparatusmay determine whether a sum of the square value of the mode number ofthe L and the square value of the mode number of the A is larger than 2.

If the L or the A is not the planar intra prediction mode and the DCintra prediction mode (namely, if the sum of the square value of themode number of the L and the square value of the mode number of the A islarger than 2), the encoding apparatus/decoding apparatus may derive ashared list S1210 and perform the next step S1220. The shared list maybe derived as part of the MPM list for the current block.

The shared list may be derived as shown in the table below.

TABLE 8 mpm[0] = L

Referring to Table 8, the shared list may include a first MPM candidaterepresenting the L. In other words, if the L or the A is not a planarintra prediction mode and a DC intra prediction mode (namely, if the sumof the square value of the mode number of the L and the square value ofthe mode number of the A is larger than 2), the encodingapparatus/decoding apparatus may derive the L as the first MPMcandidate. Referring to Table 8, mpm[0] may represent the first MPMcandidate. The shared list may represent a portion shared by MPM list 1and MPM list 2. If the value of an MPM index is 0, the first MPMcandidate may represent an MPM candidate indicated by the MPM index.

Afterwards, the encoding apparatus/decoding apparatus may check thesixth condition S1220. The sixth condition may indicate whether the Land the A are directional intra prediction modes. In other words, theencoding apparatus/decoding apparatus may determine whether the L andthe A are directional intra prediction modes. For example, the encodingapparatus/decoding apparatus may determine whether a sum of the modenumber of the L and the mode number of the A is smaller than or equal toa product of the mode number of the L and the mode number of the A.

If the sixth condition is satisfied, namely, if the L and the A aredirectional intra prediction modes, the encoding apparatus/decodingapparatus may derive the rest of the MPM list 1. In other words, theencoding apparatus/decoding apparatus may derive the MPM list 1 as anMPM list for the current block.

The rest of the MPM list 1 may be derived as shown in the table below.

TABLE 9 If (A is not included in the current MPM list )  Add A mode intothe next MPM index Add Planar_idx into the next MPM index Add DC_idxinto the next MPM index If (L−1 is not included in the current MPM list) Add A mode into the next MPM index If (L+1 is not included in thecurrent MPM list )  Add A mode into the next MPM index If (A−1 is notincluded in the current MPM list )  Add A mode into the next MPM indexIf (A−1 is not included in the current MPM list )  Add A mode into thenext MPM index If length of MPM list is equal to 6, stop MPM listgeneration process

Table 9 may represent the remaining portion of the MPM list 1 except forthe shared list. The MPM list 1 shown in Table 9 may be derived as anMPM list for the current block. Referring to FIG. 9 , it may bedetermined whether the A is included in the MPM list for the currentblock, and if the A is not included in the MPM list for the currentblock, the A may be added to the MPM list of the current block as asecond MPM candidate, a planar intra prediction mode may be added to theMPM list of the current block as a third MPM candidate, and a DC intraprediction mode may be added to the MPM list of the current block as afourth MPM candidate.

Afterwards, if L−1 is not included in the MPM list for the currentblock, the A may be added to the MPM list of the current block as an MPMcandidate. Afterwards, it may be determined whether L+1 is included inthe MPM list for the current block, and if L+1 is not included in theMPM list for the current block, the A may be added to the MPM list ofthe current block as an MPM candidate. Afterwards, it may be determinedwhether A−1 is included in the MPM list for the current block, and ifA−1 is not included in the MPM list for the current block, the A may beadded to the MPM list of the current block as an MPM candidate.Meanwhile, if the length of the MPM list for the current block is 6,namely, if the number of MPM candidates included in the MPM list is 6,the MPM list generation process may be stopped.

Also, if the sixth condition is not satisfied, namely, if at least oneof the L and the A is not a directional intra prediction mode, theencoding apparatus/decoding apparatus may derive the remaining portionof the MPM list 2. In other words, the encoding apparatus/decodingapparatus may derive the MPM list 2 as an MPM list for the currentblock.

The rest of the MPM list 2 may be derived as shown in the table below.

TABLE 10 mpm[1] = A If (DC mode is not included in the current MPM list) Add DC mode into the next MPM index Otherwise add Planar mode into thenext MPM index If (Max(L, A)−1 mode is not included in the current MPMlist)  Add L−1 mode into the next MPM index If (Max(L, A)+1 mode is notincluded in the current MPM list)  Add L+1 mode into the next MPM listindex If (Max(L, A)−2 mode is not included in the current MPM list)  AddA−1 mode into the next MPM list index If (Max(L, A)+2 mode is notincluded in the current MPM list)  Add A+1 mode into the next MPM listindex If length of MPM list is equal to 6, stop MPM list generationprocess

Table 10 may represent the remaining portion of the MPM list 2 exceptfor the shared list. The MPM list 2 shown in Table 10 may be derived asan MPM list for the current block. Referring to Table 10, the A may beadded to the MPM list of the current block as a second MPM candidate.Afterwards, it may be determined whether a DC intra prediction mode isincluded in the MPM list for the current block; if the DC intraprediction mode is not included in the MPM list for the current block,the DC intra prediction mode may be added to the MPM list of the currentblock as an MPM candidate; and if the DC intra prediction mode isincluded in the MPM list for the current block, a planar intraprediction mode may be added to the MPM list of the current block as anMPM candidate.

Afterwards, it may be determined whether an intra prediction mode havinga mode number obtained by subtracting 1 from the larger of the modenumber of the L and the mode number of the A is included in the MPM listfor the current block, and if the intra prediction mode is not includedin the MPM list for the current block, L−1 may be added to the MPM listof the current block as an MPM candidate. Here, the L−1 may represent anintra prediction mode having a mode number obtained by subtracting 1from the mode number of the L.

Afterwards, it may be determined whether an intra prediction mode havinga mode number obtained by adding 1 to the larger of the mode number ofthe L and the mode number of the A is included in the MPM list for thecurrent block, and if the intra prediction mode is not included in theMPM list for the current block, L+1 may be added to the MPM list of thecurrent block as an MPM candidate. Here, the L+1 may represent an intraprediction mode having a mode number obtained by adding 1 from the modenumber of the L.

Afterwards, it may be determined whether an intra prediction mode havinga mode number obtained by subtracting 2 from the larger of the modenumber of the L and the mode number of the A is included in the MPM listfor the current block, and if the intra prediction mode is not includedin the MPM list for the current block, A−1 may be added to the MPM listof the current block as an MPM candidate. Here, the A−1 may represent anintra prediction mode having a mode number obtained by subtracting 1from the mode number of the A.

Afterwards, it may be determined whether an intra prediction mode havinga mode number obtained by adding 2 to the larger of the mode number ofthe L and the mode number of the A is included in the MPM list for thecurrent block, and if the intra prediction mode is not included in theMPM list for the current block, A+1 may be added to the MPM list of thecurrent block as an MPM candidate. Here, the A+1 may represent an intraprediction mode having a mode number obtained by adding 1 from the modenumber of the A.

Meanwhile, if the L and the A are a planar intra prediction mode or a DCintra prediction mode (namely, if a sum of the square value of the modenumber of the L and the square value of the mode number of the A is notlarger than 2), MPM list 3 may be derived as an MPM list for the currentblock.

The MPM list 3 may be derived as shown in the table below.

TABLE 11 mpm[0]= Planar mpm[1]= DC mpm[2] = Vertical_idx mpm[3] =Horizontal_idx mpm[4] = Horizontal_Diagonal_idx mpm[5] =Vertical_Diagonal_idx

Table 11 may represent the MPM list 3. The MPM list 3 may include afirst MPM candidate representing a planar intra prediction mode, asecond MPM candidate representing a DC intra prediction mode, a thirdMPM candidate representing a vertical intra prediction mode, a fourthMPM candidate representing a horizontal intra prediction mode, a fifthMPM candidate representing a horizontal diagonal intra prediction mode,and a sixth MPM candidate representing a vertical diagonal intraprediction mode.

Meanwhile, the present disclosure proposes an embodiment described lateras a method for constructing an MPM list for the current block.

FIG. 13 illustrates one example of constructing an MPM list. Asdescribed above, in existing MPM list generation, only 3 MPM candidateshave been generated; however, with the increase of the number of intraprediction modes, the 3 MPM list may not be sufficient to represent thecorrelation between an intra prediction mode of a current block to bepredicted and intra prediction modes of its neighboring intra blocks.Therefore, a method for constructing a 6 MPM list, namely, an MPM listincluding 6 MPM candidates may be proposed. Referring to FIG. 13 , anembodiment of constructing an MPM list including 6 MPM candidates basedon intra prediction modes of the neighboring block B and the neighboringblock D may be proposed. According to the present embodiment, simplicityis retained in constructing an MPM list while a sufficient number of MPMcandidates may still be derived; therefore, better coding efficiency maybe provided than for the exiting case where 3 MPM candidates arederived.

Referring to FIG. 13 , the encoding apparatus/decoding apparatus may setthe intra prediction mode of the neighboring block B and the intraprediction mode of the neighboring block D to a default intra predictionmode S1300. For example, the default intra prediction mode may be aplanar intra prediction mode. In this case, the encodingapparatus/decoding apparatus may set the intra prediction mode of theneighboring block B and the intra prediction mode of the neighboringblock D to the planar intra prediction mode. Meanwhile, a process ofsetting the intra prediction mode of the neighboring block B to thedefault intra prediction mode may be performed when the intra predictionmode of the neighboring block B is not available. In other words, if theneighboring block B is unavailable or the neighboring block B is not anintra coded block, the process of setting the intra prediction mode ofthe neighboring block B to the default intra prediction mode may beperformed. Here, the intra coded block may represent a block coded basedon intra prediction. Also, the process of setting the intra predictionmode of the neighboring block D to the default intra prediction mode maybe performed when the intra prediction mode of the neighboring block Dis unavailable. In other words, if the neighboring block D isunavailable or the neighboring block D is not an intra coded block, theprocess of setting the intra prediction mode of the neighboring block Dto the default intra prediction mode may be performed.

The encoding apparatus/decoding apparatus may check availability of theneighboring block B and the neighboring block D S1310. The encodingapparatus/decoding apparatus may check availability of the neighboringblock B and the neighboring block D and derive the intra prediction modeof the neighboring block B and/or the neighboring block D.

For example, the S1310 step may be described in more detail as shown inFIG. 14 .

FIGS. 14 a to 14 b illustrate one example of determining availability ofthe neighboring block B and the neighboring block D.

Referring to FIG. 14 a , the encoding apparatus/decoding apparatus maydetermine whether the neighboring block D is available, and theneighboring block D is an intra coded block S1400. Here, the intra codedblock may represent a block coded based on intra prediction.

If the neighboring block D is available, and the neighboring block D isthe intra coded block, the encoding apparatus/decoding apparatus may setL of the current block as the intra prediction mode of the neighboringblock D S1410. If the neighboring block D is available, and theneighboring block D is the intra coded block, the encodingapparatus/decoding apparatus may derive the intra prediction mode of theneighboring block D as L of the current block. The L may represent afirst intra prediction mode of the current block.

Meanwhile, if the neighboring block D is unavailable, or the neighboringblock D is not the intra coded block, the encoding apparatus/decodingapparatus may set the L of the current block as the default intraprediction mode which is set as the intra prediction mode of theneighboring block D S1420. In other words, if the neighboring block D isunavailable, or the neighboring block D is not the intra coded block,the encoding apparatus/decoding apparatus may derive the default intraprediction mode as the L of the current block. Here, for example, thedefault intra prediction mode may be the planar intra prediction mode.

A procedure similar to that for the neighboring block D described indetail above may be applied to the neighboring block B. However, sincethe neighboring block B is located in an upper region of a currentblock, it is possible that the neighboring block B is located outside acurrent CTU including the current block. In other words, since theneighboring block B is located in the upper region of the current block,it is possible that the neighboring block B is not included in thecurrent CTU. If the neighboring block B is not included in the currentCTU, storing information of the neighboring block B may not be takeninto consideration in order to reduce a large amount of storage. Inother words, prediction information of the neighboring block B may notbe stored. FIG. 14 b may illustrates a method for determiningavailability of the neighboring block B in consideration of thedescriptions given above.

Referring to FIG. 14 b , the encoding apparatus/decoding apparatus maydetermine whether the neighboring block B is available, the neighboringblock B is an intra coded block, and the neighboring block B is at theCTU boundary S1430. In other words, the encoding apparatus/decodingapparatus may determine whether the neighboring block B is available,the neighboring block B is an intra coded block, and the neighboringblock B belongs to a current CTU.

If the neighboring block B is available, the neighboring block B is anintra coded block, and the neighboring block B is contained in thecurrent CTU, the encoding apparatus/decoding apparatus may set A of thecurrent block as the intra prediction mode of the neighboring block BS1440. If the neighboring block B is available, the neighboring block Bis an intra coded block, and the neighboring block B is contained in thecurrent CTU, the encoding apparatus/decoding apparatus may derive theintra prediction mode of the neighboring block B as A of the currentblock. The A may represent a second intra prediction mode of the currentblock.

Meanwhile, if the neighboring block B is unavailable, the neighboringblock D is not the intra coded block, or the neighboring block B is notcontained in the current CTU, the encoding apparatus/decoding apparatusmay set the A of the current block as the default intra prediction modewhich is set as the intra prediction mode of the neighboring block BS1450. In other words, if the neighboring block B is unavailable, theneighboring block D is not the intra coded block, or the neighboringblock B is not contained in the current CTU, the encodingapparatus/decoding apparatus may derive the default intra predictionmode as the A of the current block. Here, for example, the default intraprediction mode may be the planar intra prediction mode.

Meanwhile, the S1310 step, which is a process for determiningavailability of the neighboring block B and the neighboring block D, maybe performed in an embodiment different from the embodiment shown inFIG. 14 . For example, the S1310 step may be described as shown in FIG.15 .

FIGS. 15 a to 15 b illustrate one example of determining availability ofthe neighboring block B and the neighboring block D. FIG. 15 illustratesone example in which availability of the neighboring block B and theneighboring block D is determined when the encoding apparatus/decodingapparatus has a large amount of storage to store all the detailedinformation of reconstructed blocks. Therefore, the intra predictionmode of the neighboring block B may be available regardless of whetherthe neighboring block B is located inside or outside the current CTU.Therefore, an embodiment different from the process for determiningavailability of the neighboring block B of FIG. 14 may be proposed.

For example, referring to FIG. 15 a , the encoding apparatus/decodingapparatus may determine whether the neighboring block D is available,and the neighboring block D is an intra coded block S1500. Here, theintra coded block may represent a block coded based in intra prediction.

If the neighboring block D is available, and the neighboring block D isthe intra coded block, the encoding apparatus/decoding apparatus may setL of the current block as the intra prediction mode of the neighboringblock D S1510. If the neighboring block D is available, and theneighboring block D is the intra coded block, the encodingapparatus/decoding apparatus may derive the intra prediction mode of theneighboring block D as L of the current block. The L may represent afirst intra prediction mode of the current block.

Meanwhile, if the neighboring block D is unavailable, or the neighboringblock D is not the intra coded block, the encoding apparatus/decodingapparatus may set the L of the current block as the default intraprediction mode which is set as the intra prediction mode of theneighboring block D S1520. In other words, if the neighboring block D isunavailable, or the neighboring block D is not the intra coded block,the encoding apparatus/decoding apparatus may derive the default intraprediction mode as the L of the current block. Here, for example, thedefault intra prediction mode may be the planar intra prediction mode.

Referring to FIG. 15 b , the encoding apparatus/decoding apparatus maydetermine whether the neighboring block B is available, and theneighboring block B is an intra coded block S1530. In other words, theencoding apparatus/decoding apparatus may determine whether theneighboring block B is available, and the neighboring block B is anintra coded block. Different from the embodiment of FIG. 14 b , whetherthe neighboring block B is contained in the current CTU may not bedetermined.

If the neighboring block B is available, and the neighboring block B isan intra coded block, the encoding apparatus/decoding apparatus may setA of the current block as the intra prediction mode of the neighboringblock B S1540. If the neighboring block B is available, and theneighboring block B is an intra coded block, the encodingapparatus/decoding apparatus may derive the intra prediction mode of theneighboring block B as A of the current block. The A may represent asecond intra prediction mode of the current block.

Meanwhile, if the neighboring block B is unavailable, or the neighboringblock D is not the intra coded block, the encoding apparatus/decodingapparatus may set the A of the current block as the default intraprediction mode which is set as the intra prediction mode of theneighboring block B S1550. In other words, if the neighboring block B isunavailable, or the neighboring block D is not the intra coded block,the encoding apparatus/decoding apparatus may derive the default intraprediction mode as the A of the current block. Here, for example, thedefault intra prediction mode may be the planar intra prediction mode.

Referring again to FIG. 13 , the encoding apparatus/decoding apparatusdetermines neighboring intra prediction modes of the current blockS1320. Here, the neighboring intra prediction modes may include the Land the A. In other words, the neighboring intra prediction modes mayinclude the first intra prediction mode and the second intra predictionmode of the current block. The encoding apparatus/decoding apparatus maydetermine whether neighboring intra prediction modes of the currentblock derived through the S1310 step satisfy a specific condition and ifthe specific condition is satisfied, may modify the neighboring intraprediction modes derived through the S1310 step. For example, the S1320step may be described as shown in FIG. 16 .

FIG. 16 illustrates one example of determining neighboring intraprediction modes of the current block.

Referring to FIG. 16 , the encoding apparatus/decoding apparatus maydetermine whether the L is the same as the A, and the mode number of theL is larger than the mode number (namely, 1) of a DC intra predictionmode S1600.

If the L is the same as the A, and the mode number of the L is largerthan the mode number of the DC intra prediction mode, the encodingapparatus/decoding apparatus may set the A as a planar intra predictionmode S1610. In other words, if the L is the same as the A, and the modenumber of the L is larger than the mode number of the DC intraprediction mode, the encoding apparatus/decoding apparatus may modifythe A as a planar intra prediction mode.

Meanwhile, if the L is not the same as the A, or the mode number of theL is smaller than or equal to the mode number of the DC intra predictionmode, the encoding apparatus/decoding apparatus may maintain the L andthe A. In other words, if the L is not the same as the A, or the modenumber of the L is smaller than or equal to the mode number of the DCintra prediction mode, the encoding apparatus/decoding apparatus maydetermine the L and the A derived in the S1310 step as the neighboringintra prediction modes of the current block.

Referring again to FIG. 13 , the encoding apparatus/decoding apparatusmay derive a case for the current block based on the neighboring intraprediction modes S1330. In other words, based on the neighboring intraprediction modes, the encoding apparatus/decoding apparatus may derive acase to which the current block corresponds. For example, the S1330 stepmay be described as shown in FIG. 17 .

FIG. 17 illustrates one example of deriving a case for the current blockbased on the neighboring intra prediction modes.

The encoding apparatus/decoding apparatus may determine whether the modenumber of the L is larger than the mode number (namely, 1) of a DC intraprediction mode, and the mode number of the A is larger than the modenumber (namely, 1) of the DC intra prediction mode S1700. In otherwords, the encoding apparatus/decoding apparatus may determine whetherthe L and the A are directional intra prediction modes. If the modenumber of the L is larger than the mode number of the DC intraprediction mode, and the mode number of the A is larger than the modenumber of the DC intra prediction mode (namely, if the L and the A aredirectional intra prediction modes), the encoding apparatus/decodingapparatus may derive the case for the current block as case 1.

Meanwhile, if the mode number of the L is not larger than the modenumber of the DC intra prediction mode, or the mode number of the A isnot larger than the mode number of the DC intra prediction mode (namely,if at least one of the mode number of the A and the mode number of the Ais not larger than the mode number of the DC intra prediction mode), theencoding apparatus/decoding apparatus may determine whether the bitwiseOR operation of the L and the A is larger than the mode number of the DCintra prediction mode S1710. If the mode number of the L is not largerthan the mode number of the DC intra prediction mode, or the mode numberof the A is not larger than the mode number of the DC intra predictionmode (namely, if at least one of the mode numbers of the L and the A isnot larger than the mode number of the DC intra prediction mode), theencoding apparatus/decoding apparatus may determine whether the bitwiseOR operation of the mode number of the L and the mode number of the A islarger than the mode number of the DC intra prediction mode. The bitwiseOR operation of the mode number of the L and the mode number of the Amay be derived as the OR operation of the binary value of the modenumber of the L and the binary value of the mode number of the A.Meanwhile, “|” shown in FIG. 17 may denote the bitwise OR operation. Forexample, suppose the bitwise OR operation is applied to 2 and 1. Sincethe binary representation of 2 is 10, and the binary representation of 1is 01, 2|1 may be derived as a binary value of 11, where the binaryvalue 11 may represent 3. If the bitwise OR operation of the mode numberof the L and the mode number of the A (namely, L|A) is larger than themode number of the DC intra prediction mode, it may represent a casewhere one of the L and the A is a directional intra prediction mode. Ifthe bitwise OR operation of the mode number of the L and the mode numberof the A (namely, L|A) is larger than the mode number of the DC intraprediction mode, the encoding apparatus/decoding apparatus may derivethe case for the current block as case 3.

Referring again to FIG. 13 , the encoding apparatus/decoding apparatusmay construct an MPM list of the current block according to the derivedcase S1340.

For example, if the case for the current block is case 1, namely, ifboth of the L and the A are directional intra prediction modes, the MPMlist for the current block may be constructed as shown in FIG. 18 .

FIGS. 18 a to 18 b illustrate one example of constructing an MPM list ofthe current block when the case for the current block is case 1.

The present disclosure proposes two embodiments for constructing an MPMlist of the current block when the cases for the current block shown inFIGS. 18 a and 18 b are case 1. Meanwhile, in both of the embodiments ofFIGS. 18 a and 18 b , the L, the A, the planar intra prediction mode,and the DC intra prediction mode may be derived as a first MPMcandidate, second MPM candidate, third MPM candidate, and fourth MPMcandidate of the MPM list of the current block, respectively. Here, thefirst MPM candidate may represent an MPM candidate having an MPM indexof 0, the second MPM candidate may represent an MPM candidate having anMPM index of 1, the third MPM candidate may represent an MPM candidatehaving an MPM index of 2, and the fourth MPM candidate may represent anMPM candidate having an MPM index of 3. Also, the first MPM candidatemay be denoted by mpm[0], the second MPM candidate may be denoted bympm[1], the third MPM candidate may be denoted by mpm[2], and the fourthMPM candidate may be denoted by mpm[3].

For example, referring to FIG. 18 a , the encoding apparatus/decodingapparatus may derive the L, the A, the planar intra prediction mode, andthe DC intra prediction mode as the first, the second, the third, andthe fourth MPM candidate of the MPM list of the current block S1800.

Afterwards, the encoding apparatus/decoding apparatus may derive maxidxand diff S1805. Here, the maxidx may represent an MPM index indicatingan MPM candidate having the larger mode number between the MPM candidaterepresenting the A and the MPM candidate representing the L; and diffmay represent a difference between the MPM candidate representing the Aand the MPM candidate representing the L.

Also, the maxidx and the diff may be derived based on the L and the A.For example, the maxidx and the diff may be derived as shown in thetable below.

TABLE 12 If L>A, max_idx is 0 and min_idx is 1. Otherwise, max_idx is 1and min_idx is 0. diff=mpm[max_idx]−mpm[min_idx]

Referring to Table 12, if the mode number of the L is larger than themode number of the A, the maxidx may be derived as 0, and minidx may bederived as 1. Also, if the mode number of the L is not larger than themode number of the A, the maxidx may be derived as 1, and minidx may bederived as 0.

Also, the diff may be derived as a value obtained by subtracting an MPMcandidate indicated by the minidx from the MPM candidate indicated bythe maxidx.

Afterwards, the encoding apparatus/decoding apparatus may determinewhether the value of diff is not 64 and is not 1 S1810. The exclamationmark shown in FIG. 18 may represent the logical NOT operator. Thelogical NOT operator may represent an operator that converts a falsevalue to true or a true value to false. For example, the value of !7 maybe 0, and the value of !0 may be 1. As another example, the value of !1may be 0, and the value of !0 may be 1.

If the diff is not 64 and is not 1, the encoding apparatus/decodingapparatus may derive an intra prediction mode having a mode numberobtained by subtracting 1 from the mode number of the MPM candidateindicated by the maxidx as the fifth MPM candidate of the current blockand derive an intra prediction mode having a mode number obtained byadding 1 to the mode number of the MPM candidate indicated by the maxidxas the sixth MPM candidate of the current block S1815.

Also, if the diff is 64 or 1, the encoding apparatus/decoding apparatusmay derive an intra prediction mode having a mode number obtained bysubtracting 2 from the mode number of the MPM candidate indicated by themaxidx as the fifth MPM candidate of the current block and derive anintra prediction mode having a mode number obtained by adding 2 to themode number of the MPM candidate indicated by the maxidx as the sixthMPM candidate of the current block S1820.

FIG. 18 b may represent another example of constructing an MPM list ofthe current block when the case for the current block is case 1.

Referring to FIG. 18 b , the encoding apparatus/decoding apparatus mayderive the L, the A, the planar intra prediction mode, and the DC intraprediction mode as the first, the second, the third, and the fourth MPMcandidate of the MPM list of the current block S1825.

Afterwards, the encoding apparatus/decoding apparatus may derive L−1 andL+1 S1830. The L−1 may represent a value obtained by subtracting 1 fromthe mode number of the L, and the L+1 may represent a value obtained byadding 1 to the mode number of the L.

The encoding apparatus/decoding apparatus may determine whether the L−1is the same as the A S1835. In other words, the encodingapparatus/decoding apparatus may determine whether the L−1 is the sameas the mode number of the A.

If the L−1 is the same as the A, the encoding apparatus/decodingapparatus may derive an intra prediction mode having a mode numberobtained by subtracting 1 from the mode number of the A as the fifth MPMcandidate of the current block and derive an intra prediction modehaving a mode number obtained by adding 1 to the mode number of the L asthe sixth candidate of the current block.

Meanwhile, if the L−1 is not the same as the A, the encodingapparatus/decoding apparatus may determine whether the L+1 is the sameas the A S1845. In other words, the encoding apparatus/decodingapparatus may determine whether the L+1 is the same as the mode numberof the A.

If the L+1 is the same as the A, the encoding apparatus/decodingapparatus may derive an intra prediction mode having a mode numberobtained by subtracting 1 from the mode number of the L as the fifth MPMcandidate of the current block and derive an intra prediction modehaving a mode number obtained by adding 1 to the mode number of the A asthe sixth candidate of the current block S1850.

If the L+1 is not the same as the A, the encoding apparatus/decodingapparatus may derive an intra prediction mode having a mode numberobtained by subtracting 1 from the mode number of the L as the fifth MPMcandidate of the current block and derive an intra prediction modehaving a mode number obtained by adding 1 to the mode number of the L asthe sixth candidate of the current block S1855.

Meanwhile, in the description above, intra prediction mode+1, intraprediction mode−1, intra prediction mode+2, and intra prediction mode −2(for example, L+1, L−1, A+1, and A−1) may not be calculated by simplyadding or subtracting a particular value mathematically.

For example, in some cases, a value derived by adding or subtracting avalue to or from a directional intra prediction mode may represent anon-directional intra prediction mode for which consistency is notmaintained or may exceed the maximum available intra prediction modeindex. As one example, a value obtained by subtracting 1 from adirectional intra prediction mode may be derived as 1 indicating a DCintra prediction mode. Also, as another example, a value obtained byadding 1 to 66 intra prediction mode may be derived as 67, where the 67may be a value exceeding the maximum available intra prediction modeindex (namely, 66). Therefore, adding and subtracting a value to andfrom a mode may not be conducted by simply adding or subtracting aparticular value mathematically, but modular arithmetic may be usedinstead. The modular arithmetic may be denoted by %. Adding andsubtracting a value to and from a mode may be restricted to use themodular arithmetic. In other words, a value representing anon-directional intra prediction mode for which consistency is notmaintained or a value exceeding the maximum available intra mode indexmay be prevented from being derived. For example, when modulararithmetic is used, adding and subtracting a value to and from a modemay be derived as shown in the table below.

TABLE 13 - Intra mode −1 : (Intra mode +62)%65+2 - Intra mode +1 :(Intra mode −1)%65+2 - Intra mode −2 : (Intra mode +61)%65+2

Meanwhile, for example, if the case for the current block is case 2,namely, if one of the L and the A is a directional intra predictionmode, an MPM list of the current block may be constructed as shown inFIG. 19 .

FIGS. 19 a to 19 b illustrate one example of constructing an MPM list ofthe current block when the case for the current block is case 2.

The present disclosure proposes two embodiments for constructing an MPMlist of the current block when the cases for the current block shown inFIGS. 19 a and 19 b are case 2. Meanwhile, in both of the embodiments ofFIGS. 19 a and 19 b , the L and the A may be derived as a first MPMcandidate and a second MPM candidate of the MPM list of the currentblock. Here, the first MPM candidate may represent an MPM candidatehaving an MPM index of 0, and the second MPM candidate may represent anMPM candidate having an MPM index of 1. Also, the first MPM candidatemay be denoted by mpm[0], and the second MPM candidate may be denoted bympm[1].

For example, referring to FIG. 19 a , the encoding apparatus/decodingapparatus may derive the L and the A as the first and the second MPMcandidate of the MPM list of the current block S1900.

Afterwards, the encoding apparatus/decoding apparatus may derive maxidxS1905. Here, the maxidx may represent an MPM index indicating an MPMcandidate having the larger mode number between the MPM candidaterepresenting the A and the MPM candidate representing the L. The maxidxmay be derived as shown in Table 12 above. For example, if the modenumber of the L is larger than the mode number of the A, the maxidx maybe derived as 0, and minidx may be derived as 1. Also, if the modenumber of the L is not larger than the mode number of the A, the maxidxmay be derived as 1, and minidx may be derived as 0.

Afterwards, the encoding apparatus/decoding apparatus may derive theremaining MPM candidates of the MPM list of the current block based onthe maxidx S1910.

For example, the third MPM candidate, the fourth MPM candidate, thefifth MPM candidate, and the sixth MPM candidate of the MPM list may bederived as shown in the table below.

TABLE 14 mpm[2] = ! mpm[min_idx] mpm[3] = mpm[max_idx]−1 mpm[4] =mpm[max_idx]+1 mpm[5] = mpm[max_idx]−2

Here, the third MPM candidate may represent an MPM candidate having anMPM index of 2, the fourth MPM candidate may represent an MPM candidatehaving an MPM index of 3, the fifth MPM candidate may represent an MPMcandidate having an MPM index of 4, and the sixth MPM candidate mayrepresent an MPM candidate having an MPM index of 5.

Also, the third MPM candidate may be denoted by mpm[2], the fourth MPMcandidate may be denoted by mpm[3], the fifth MPM candidate may bedenoted by mpm[4], and the sixth MPM candidate may be denoted by mpm[5].Referring to Table 14, the third MPM candidate may be derived as anintra prediction mode having a value obtained by applying the logicalNOT operator to the MPM candidate indicated by the minidx, the fourthMPM candidate may be derived as an intra prediction mode having a valueobtained by subtracting 1 from the MPM candidate indicated by themaxidx, the fifth MPM candidate may be derived as an intra predictionmode having a value obtained by adding 1 to the MPM candidate indicatedby the maxidx, and the sixth MPM candidate may be derived as an intraprediction mode having a value obtained by subtracting 2 from the MPMcandidate indicated by the maxidx.

FIG. 19 b illustrates another example of constructing an MPM list of thecurrent block when the case for the current block is case 2.

Referring to FIG. 19 b , the encoding apparatus/decoding apparatus mayderive the L and the A as the first MPM candidate and the second MPMcandidate of the MPM list of the current block S1915.

Afterwards, the encoding apparatus/decoding apparatus may derive maxidxS1920. Here, the maxidx may represent an MPM index indicating an MPMcandidate having the larger mode number between the MPM candidaterepresenting the A and the MPM candidate representing the L. The maxidxmay be derived as shown in Table 12. For example, if the mode number ofthe L is larger than the mode number of the A, the maxidx may be derivedas 0, and the minidx may be derived as 1. Also, if the mode number ofthe L is not larger than the mode number of the A, the maxidx may bederived as 1, and the minidx may be derived as 0.

Afterwards, the encoding apparatus/decoding apparatus may derive thethird MPM candidate, the fourth MPM candidate, and the fifth MPMcandidate of the MPM list of the current block based on the maxidxS1925. For example, the third MPM candidate may be derived as an intraprediction mode having a value obtained by applying the logical NOToperator to the MPM candidate indicated by the minidx, the fourth MPMcandidate may be derived as an intra prediction mode having a valueobtained by subtracting 1 from the MPM candidate indicated by themaxidx, and the fifth MPM candidate may be derived as an intraprediction mode having a value obtained by adding 1 to the MPM candidateindicated by the maxidx.

Afterwards, the encoding apparatus/decoding apparatus may determinewhether the L is larger than 48 and smaller than 52 S1930.

If the L is larger than 48 and smaller than 52, the encodingapparatus/decoding apparatus may derive the sixth MPM candidate of theMPM list of the current block as a horizontal intra prediction modeS1935. For example, the horizontal intra prediction mode may representthe 18 intra prediction mode. If the L is larger than 48 and smallerthan 52, the encoding apparatus/decoding apparatus may derive the sixthMPM candidate of the MPM list of the current block as the 18 intraprediction mode.

Also, if the L is smaller than or equal to 48, or the L is larger thanor equal to 52, the encoding apparatus/decoding apparatus may derive thesixth MPM candidate of the MPM list of the current block as a verticalintra prediction mode S1940. For example, if the vertical intraprediction mode may represent 50 intra prediction mode. If the L issmaller than or equal to 48, or the L is larger than or equal to 52, theencoding apparatus/decoding apparatus may derive the sixth MPM candidateof the MPM list of the current block as the 50 intra prediction mode.

Meanwhile, for example, if the case for the current block is case 3,namely, if both of the L and the A are non-directional intra predictionmodes, the MPM list of the current block may be constructed as shown inFIG. 20 .

FIG. 20 illustrates one example of constructing an MPM list of thecurrent block when the case for the current block is case 3.

Referring to FIG. 20 , the encoding apparatus/decoding apparatus mayderive an MPM list of the current block as an MPM list for the case 3S2000.

For example, if the case for the current block is case 3, the MPM listof the current block may be derived as shown in the table below.

TABLE 15 mpm[0] = L mpm[1] = ! L mpm[2] = Vertical_idx mpm[3] =Horizontal_idx mpm[4] = Vertical_idx−4 mpm[5] = Vertical_idx+4

The encoding apparatus/decoding apparatus may derive an MPM listincluding a first MPM candidate to a sixth MPM candidate as shown inTable 15.

Here, the first MPM candidate may represent an MPM candidate having anMPM index of 0, the second MPM candidate may represent an MPM candidatehaving an MPM index of 1, the third MPM candidate may represent an MPMcandidate having an MPM index of 2, the fourth MPM candidate mayrepresent an MPM candidate having an MPM index of 3, the fifth MPMcandidate may represent an MPM candidate having an MPM index of 4, andthe sixth MPM candidate may represent an MPM candidate having an MPMindex of 5. Also, the first MPM candidate may be denoted by mpm[0], thesecond MPM candidate by mpm[1], the third MPM candidate by mpm[2], thefourth MPM candidate by mpm[3], the fifth MPM candidate by mpm[4], andthe sixth MPM candidate by mpm[5]. Referring to Table 15, the first MPMcandidate may be derived by the L, the second MPM candidate may bederived as an intra prediction mode having a value obtained by applyingthe logical NOT operator to the L, the third MPM candidate may bederived as a vertical intra prediction mode, the fourth MPM candidatemay be derived as a horizontal intra prediction mode, the fifth MPMcandidate may be derived as an intra prediction mode having a valueobtained by subtracting 4 from the vertical intra prediction mode, andthe sixth MPM candidate may be derived as an intra prediction modehaving a value obtained by adding 4 to the vertical intra predictionmode.

Meanwhile, the encoding apparatus may construct an MPM list as describedabove and calculate a rate-distortion curve by deriving a plurality ofcandidates from the MPM list for efficient rate-distortion optimization(RDO). Afterwards, among the MPM candidates, an optimal intra predictionmode that optimizes rate and distortion may be determined. Therefore,after the MPM list is constructed, 1, 2, or 3 of the first MPM index maybe derived. For example, if one MPM candidate is derived, mpm[0] may beput into RDO. Meanwhile, although the number of MPM candidates does nothave a normative reference to be followed, it may be an issue for theencoding apparatus, which may have an influence on the codingefficiency. Accordingly, the present disclosure proposes a method forincluding two or three MPM candidates in a complete RDO calculation. Forexample, if the L is the same as the A after component 3, two MPMcandidates may be used, otherwise three MPM candidates may be used.

Meanwhile, the present disclosure proposes an embodiment to be describedbelow, as a method for constructing an MPM list for the current block.

FIG. 21 illustrates one example of constructing an MPM list for acurrent block.

FIG. 21 illustrates one embodiment for efficiently constructing an MPMlist for the current block containing k MPM candidates based onneighboring blocks of the current block. For example, k may be 6, andamong 5 efficient lists, 5 conditions may be used to construct an MPMlist for the current block. Meanwhile, referring to FIG. 21 , L mayrepresent an intra prediction mode of the neighboring block B, and A mayrepresent an intra prediction mode of the neighboring block D. Or,referring to FIG. 21 , L may represent an intra prediction mode of theneighboring block D, and A may represent an intra prediction mode of theneighboring block B.

More specifically, referring to FIG. 21 , the encodingapparatus/decoding apparatus may check condition 1 indicating whetherthe L is the same as the A S2100. In other words, the encodingapparatus/decoding apparatus may determine whether the L is the same asthe A.

If the L is the same as the A, the encoding apparatus/decoding apparatusmay determine condition 2 indicating whether the mode number of the L islarger than the mode number of a DC intra prediction mode 52110. Inother words, if the L is the same as the A, the encodingapparatus/decoding apparatus may check whether the L is the same as theA, and the L and the A are directional intra prediction modes. If thesecond condition is satisfied, MPM list 1 may be derived as an MPM listfor the current block, otherwise MPM list 2 may be derived as an MPMlist for the current block.

The MPM list 1 may be derived as shown in the table below.

TABLE 16 mpm[0] = L mpm[2] = Planar_idx mpm[3] = DC_idx mpm[3] = L−1mpm[4] = L+1 mpm[5] = L−2

Referring to Table 16, the MPM list 1 may include a first MPM candidaterepresenting L, a second MPM candidate representing a planar intraprediction mode, a third MPM candidate representing a DC intraprediction mode, a fourth MPM candidate representing L−1, a fifth MPMcandidate representing L+1, and a sixth MPM candidate representing L−2.

Also, the MPM list 2 may be derived as shown in the table below.

TABLE 17 mpm[0] = L mpm[1] = ! L mpm[2] = Vertical_idx mpm[3] =Horizontal_idx mpm[4] = Vertical_idx−4 mpm[5] = Vertical_idx+4

Referring to Table 17, the MPM list 2 may include a first MPM candidaterepresenting L, a second MPM candidate representing an intra predictionmode having a value obtained by applying the logical NOT operator to theL, a third MPM candidate representing a vertical intra prediction mode,a fourth MPM candidate representing a horizontal intra prediction mode,a fifth MPM candidate representing an intra prediction mode having avalue obtained by subtracting 4 from the vertical intra prediction mode,and a sixth MPM candidate representing an intra prediction mode having avalue obtained by adding 4 to the vertical intra prediction mode.

Meanwhile, the first MPM candidate may represent an MPM candidate havingan MPM index of 0, the second MPM candidate may represent an MPMcandidate having an MPM index of 1, the third MPM candidate mayrepresent an MPM candidate having an MPM index of 2, the fourth MPMcandidate may represent an MPM candidate having an MPM index of 3, thefifth MPM candidate may represent an MPM candidate having an MPM indexof 4, and the sixth MPM candidate may represent an MPM candidate havingan MPM index of 5. Also, the first MPM candidate may be denoted bympm[0], the second MPM candidate by mpm[1], the third MPM candidate bympm[2], the fourth MPM candidate by mpm[3], the fifth MPM candidate bympm[4], and the sixth MPM candidate by mpm[5].

Meanwhile, if the L is not the same as the A, the encodingapparatus/decoding apparatus may derive a shared list 1 S2120 and mayperform the next step S2130. The shared list 1 may be derived as part ofthe MPM list for the current block.

The shared list 1 may be derived as shown in the table below.

TABLE 18 mpm[0] = L mpm[1] = A If L>A, max_idx is 0 and min_idx is 1.Otherwise, max_idx is 1 and min_idx is 0.

Referring to Table 18, the shared list 1 may include a first MPMcandidate representing the L and a second MPM candidate representing theA. In other words, if the L is not the same as the A, the encodingapparatus/decoding apparatus may derive the L as the first MPM candidateand derive the A as the second MPM candidate. Referring to FIG. 18 ,mpm[0] may denote the first MPM candidate, and mpm[1] may denote thesecond MPM candidate. The first MPM candidate may represent an MPMcandidate indicated by the MPM index having a value of 0, and the secondMPM candidate may represent an MPM candidate indicated by the MPM indexhaving a value of 1.

Also, referring to Table 18, maxidx and minidx may be derived based onthe L and the A. For example, if the L is larger than the A, the maxidxmay be derived as 0, and the minidx may be derived as 1. Also, forexample, if the L is not larger than the A, the maxidx may be derived as1, and the minidx may be derived as 0.

Afterwards, the encoding apparatus/decoding apparatus may check a thirdcondition S2130. The third condition may indicate whether the modenumber of the L is larger than the mode number of a DC intra predictionmode, and the mode number of the A is larger than the mode number of theDC intra prediction mode.

If the third condition is satisfied, namely, if the mode number of the Lis larger than the mode number of the DC intra prediction mode, and themode number of the A is larger than the mode number of the DC intraprediction mode, the encoding apparatus/decoding apparatus may deriveshared list 2 S2130 and may perform the next step S2150.

The shared list 2 may be derived as part of the MPM list for the currentblock.

The shared list 2 may be derived as shown in the table below.

TABLE 19 mpm[2] = Planar_idx mpm[3] = DC_idxdiff=mpm[max_idx]−mpm[min_idx]

Referring to Table 19, the shared list 2 may include a third MPMcandidate representing a planar intra prediction mode and a fourth MPMcandidate representing a DC intra prediction mode. In other words, ifthe mode number of the L is larger than the mode number of the DC intraprediction mode, and the mode number of the A is larger than the modenumber of the DC intra prediction mode, the encoding apparatus/decodingapparatus may derive the planar intra prediction mode as the third MPMcandidate and derive the DC intra prediction mode as the fourth MPMcandidate. Referring to Table 19, mpm[2] may denote the third MPMcandidate, and mpm[3] may denote the fourth MPM candidate. The third MPMcandidate may represent an MPM candidate indicated by the MPM indexhaving a value of 2, and the fourth MPM candidate may represent an MPMcandidate indicated by the MPM index having a value of 3.

Also, referring to Table 19, diff may be derived based on the maxidx andthe minidx derived as shown in Table 18. For example, the diff may bederived as a difference between an MPM candidate indicated by an MPMindex having a value determined by the maxidx and an MPM candidateindicated by an MPM index having a value determined by the minidx. Thediff may represent a difference between the L and the A.

Afterwards, the encoding apparatus/decoding apparatus may check a fourthcondition S2150. The fourth condition may indicate whether the diff isnot 64 and is not 1. In other words, the encoding apparatus/decodingapparatus may determine whether the diff is not 64 and is not 1. Theencoding apparatus may determine whether a difference between the L andthe A is 64 and 1.

If the fourth condition is satisfied, namely, if the diff is not 64 andis not 1, the remaining part of the MPM list of the current block may bederived as shown in the table below.

TABLE 20 mpm[4] = mpm[max_idx]−2 mpm[5] = mpm[max_idx]+2

Referring to Table 20, if the fourth condition is satisfied, namely, ifthe diff is not 64 and is not 1, the encoding apparatus/decodingapparatus may derive an intra prediction mode having a value obtained bysubtracting 1 from the MPM candidate indicated by the maxidx as thefifth MPM candidate and derive an intra prediction mode having a valueobtained by adding 1 to the MPM candidate indicated by the maxidx as thesixth MPM candidate. If the fourth condition is satisfied, the MPM listof the current block may be derived as MPM list 5. In other words, Table20 may represent the remaining portion of the MPM list 5. The MPM list 5may include the shared list 1, the shared list 2, and the remainingportion of the MPM list 5 disclosed in Table 20.

Meanwhile, if the fourth condition is not satisfied, namely, if the diffis 64 or 1, the remaining portion of the MPM list of the current blockmay be derived as shown in the table below.

TABLE 21 mpm[4] = mpm[max_idx]−1 mpm[5] = mpm[max_idx]+1

Referring to Table 21, if the fourth condition is not satisfied, namely,if the diff is 64 or 1, the encoding apparatus/decoding apparatus mayderive an intra prediction mode having a value obtained by subtracting 2from the MPM candidate indicated by the maxidx as the fifth MPMcandidate and derive an intra prediction mode having a value obtained byadding 2 to the MPM candidate indicated by the maxidx as the sixth MPMcandidate. If the fourth condition is not satisfied, the MPM list of thecurrent block may be derived as MPM list 4. In other words, Table 21 mayrepresent the remaining portion of the MPM list 4. The MPM list 4 mayinclude the shared list 1, the shared list 2, and the remaining portionof the MPM list 4 disclosed in Table 21.

Meanwhile, if the third condition is not satisfied, namely, if the modenumber of the L is not larger than the mode number of a DC intraprediction mode, or the mode number of the A is not larger than the modenumber of the DC intra prediction mode, the encoding apparatus/decodingapparatus may check a fifth condition S2160. The fifth condition mayindicate whether one of the L and the A is a directional intraprediction mode. In other words, the encoding apparatus/decodingapparatus may determine whether one of the L and the A is a directionalintra prediction mode. For example, the encoding apparatus/decodingapparatus may determine whether a sum of the mode number of the L andthe mode number of the A is larger than or equal to 2.

If the fifth condition is satisfied, namely, if a sum of the mode numberof the L and the mode number of the A is larger than or equal to 2 (ifone of the L and the A is a directional intra prediction mode), theremaining portion of the MPM list of the current block may be derived asshown in the table below.

TABLE 22 mpm[2] = ! mpm[min_idx] mpm[3] = mpm[max_idx]−1 mpm[4] =mpm[max_idx]+1 mpm[5] = mpm[max_idx]−2

Referring to Table 22, if the fifth condition is satisfied, namely, ifthe sum of the mode number of the L and the mode number of the A islarger than or equal to 2 (if one of the L and the A is a directionalintra prediction mode), the encoding apparatus/decoding apparatus mayderive an intra prediction mode having a value obtained by applying thelogical NOT operator to the MPM candidate indicated by the minidx as athird MPM candidate, derive an intra prediction mode having a valueobtained by subtracting 1 from the MPM candidate indicated by the maxidxas a fourth MPM candidate, derive an intra prediction mode having avalue obtained by adding 1 to the MPM candidate indicated by the maxidxas a fifth MPM candidate, and derive an intra prediction mode having avalue obtained by subtracting 2 from the MPM candidate indicated by themaxidx as a sixth MPM candidate. If the fifth condition is satisfied,the MPM list of the current block may be derived as MPM list 3. In otherwords, Table 22 may represent the remaining portion of the MPM list 3.The MPM list 3 may include the shared list 1 and the remaining portionof the MPM list disclosed in Table 22.

Meanwhile, if the fifth condition is not satisfied, namely, if the sumof the mode number of the L and the mode number of the A is smaller than2 (if both of the L and the A are non-directional intra predictionmodes), the remaining portion of the MPM list of the current block maybe derived as shown in Table 17.

More specifically, for example, if the fifth condition is not satisfied,namely, if a sum of the mode number of the L and the mode number of theA is smaller than 2 (if both of the L and the A are non-directionalintra prediction mode), the encoding apparatus/decoding apparatus mayderive the L as a first MPM candidate, derive an intra prediction modehaving a value obtained by applying the logical NOT operator to the L asa second MPM candidate, derive a vertical intra prediction mode as athird MPM candidate, derive a horizontal intra prediction mode as afourth MPM candidate, derive an intra prediction mode having a valueobtained by subtracting 4 from the vertical intra prediction mode as afifth MPM candidate, and derive an intra prediction mode having a valueobtained by adding 4 to the vertical intra prediction mode as a sixthMPM candidate. If the fifth condition is not satisfied, the MPM list ofthe current block may be derived as MPM list 2.

As described in the embodiment above, the encoding apparatus mayconstruct an MPM list of the current block and determine whether anoptimal intra prediction mode to be applied to the current block isincluded in the configured MPM candidates (or MPM list). If the intraprediction mode of the current block belongs to the MPM candidates, theencoding apparatus may encode an MPM flag and an MPM index. Here, theMPM flag may indicate whether the intra prediction mode of the currentblock is included in the MPM list. Also, the MPM index may represent anMPM candidate derived as an intra prediction mode of the current blockamong the MPM candidates. Meanwhile, if the intra prediction mode of thecurrent block does not belong to the MPM candidates, the encodingapparatus may encode information representing the intra prediction modeof the current block.

Also, the decoding apparatus may configure MPM candidates as in theembodiment described above in the same way as the encoding apparatus.Afterwards, the decoding apparatus may check, based on the MPM flagreceived from the encoding apparatus, whether the intra prediction modeapplied to the current block belongs to the configured MPM candidates.If the intra prediction mode applied to the current block belongs to theMPM candidates, the decoding apparatus may derive an intra predictionmode applied to the current block by using the MPM index received fromthe encoding apparatus. Meanwhile, if the intra prediction mode appliedto the current block does not belong to the MPM candidates, the decodingapparatus may derive an intra prediction mode applied to the currentblock based on a prediction mode index (or the remaining intraprediction mode index) indicating a specific intra prediction mode amongthe remaining prediction modes except for the MPM candidates.

Meanwhile, the present disclosure proposes another embodiment forconstructing an MPM list including 6 MPM candidates as described below.

For example, a pseudo code illustrating another embodiment forconstructing an MPM list including 6 MPM candidates may be derived asshown in the table below.

TABLE 23 Determine LEFT and ABOVE intra modes Set MPM as MPM_ordering_0If (LEFT==ABOVE) If (LEFT>=DC_idx), then set MPM as MPM_ordering_1 Elseif (LEFT>DC_idx and ABOVE>DC_idx), then set MPM as MPM_ordering_2 Elseif (LEFT+ABOVE> DC_idx), then set MPM as MPM_ordering_3

Referring to Table 23, an MPM list of the current block may be generatedbased on LEFT and ABOVE, which are neighboring intra prediction modes.The LEFT may represent an intra prediction mode of neighboring block Dof the current block, and the ABOVE may represent an intra predictionmode of neighboring block B of the current block. The neighboring blockD may represent a left neighboring block located at the lowermost sideamong left neighboring blocks adjacent to the left side of the currentblock, and the neighboring block B may represent an upper neighboringblock located at the rightmost side among neighboring block adjacent tothe upper side of the current block.

Referring to Table 23, the MPM list of the current block may beconfigured as a first MPM list. MPM_ordering_0 may represent the firstMPM list.

Afterwards, if the LEFT is the same as the ABOVE, and the mode number ofthe LEFT is larger than or equal to the mode number of a DC intraprediction mode, the MPM list of the current block may be configured asa second MPM list. MPM_ordering_1 may represent the second MPM list.

Also, if the LEFT is not the same as the ABOVE, the mode number of theLEFT is larger than the mode number of the DC intra prediction mode, andthe mode number of the DC intra prediction mode is larger than the modenumber of the ABOVE, the MPM list of the current block may be configuredas a third MPM list. MPM_ordering_2 may represent the third MPM list.

Also, if the LEFT is not the same as the ABOVE, one of the mode numberof the LEFT and the mode number of the ABOVE is not larger than the modenumber of the DC intra prediction mode, and a sum of the mode number ofthe LEFT and the mode number of the ABOVE is larger than the mode numberof the DC intra prediction mode, the MPM list of the current block maybe configured as a fourth MPM list. MPM_ordering_3 may represent thefourth MPM list.

Meanwhile, the present disclosure proposes yet another embodiment forconstructing an MPM list including 6 MPM candidates as described below.

For example, yet another embodiment for constructing an MPM listincluding 6 MPM candidates may be derived as shown in the table below.

TABLE 24 1.  The neighbouring locations ( xNbA, yNbA ) and ( xNbB, yNbB) are set equal to ( xCb − 1, yCb+ cbHeight − 1 ) and ( xCb+ cbWidth −1, yCb − 1 ), respectively. 2.  For X being replaced by either A or B,the variables candIntraPredModeX are derived as follows:  - Theavailability derivation process for a block as specified in clause 6.4.X[Ed. (BB): Neighbouring blocks avail ability checking process tbd] isinvoked with the location ( xCurr, yCurr ) set equal to ( xCb, yCb ) andthe neigh bouring location ( xNbY, yNbY ) set equal to ( xNbX, yNbX ) asinputs, and the output is assigned to availableX.  - The candidate intraprediction mode candIntraPredModeX is derived as follows: - If one ormore of the following conditions are true, candIntraPredModeX is setequal to INTRA_PLANAR.   - The variable availableX is equal to FALSE.  - CuPredMode[ xNbX ][ yNbX ] is not equal to MODE_INTRA.   - X isequal to B and yCb − 1 is less than ( ( yCb >> CtbLog2SizeY ) <<CtbLog2SizeY ). - Otherwise, candIntraPredModeX is set equal toIntraPredModeY[ xNbX ][ yNbX ]. 3.  The candModeList[ x ] with x = 0..5is derived as follows:  - candModeList[ 0 ] =candIntraPredModeA          (8-1) candModeList[ 1 ] = !candIntraPredModeA          (8-2) candModeList[ 2 ] =INTRA_ANGULAR50        (8-3) candModeList[ 3 ] =INTRA_ANGULAR18        (8-4) candModeList[ 4 ] =INTRA_ANGULAR46        (8-5) candModeList[ 5 ] =INTRA_ANGULAR54        (8-6)  - If candIntraPredModeB is equal tocandIntraPredModeA, the following applies:  - If candIntraPredModeA islarger than 1, candModeList[ x ] with x = 0..5 is derived as follows:candModeList[ 0 ] = candIntraPredModeA         (8 7) candModeList[ 1 ] =INTRA_PLANAR        (8-8) candModeList[ 2 ] = INTRA_DC           (8 9)candModeList[ 3 ] = 2 + ( ( candIntraPredModeA + 62 ) % 65 )    (8-10)candModeList[ 4 ] = 2 + ( ( candIntraPredModeA − 1 ) % 65 )    (8-11)candModeList[ 5 ] = 2 + ( ( candIntraPredModeA + 61 ) % 65 )     (8-12) - Otherwise (candIntraPredModeB is not equal to candIntraPredModeA),the following applies: - candModeList[ 0 ] and candModeList[ 1 ] arederived as follows: candModeList[ 0 ] = candIntraPredModeA (8-13)candModeList[ 1 ] = candIntraPredModeB (8-14) - Set the variablebiggerIdx is as follows biggerIdx = candModeList[ 0 ] > candModeList[ 1] ? 0 : 1        (8-15) - If both of candIntraPredModeA andcandIntraPredModeB are larger than 1, candModeList[ x ] with x = 2.. 5is derived as follows: candModeList[ 2 ] = INTRA_PLANAR         (8-16)candModeList[ 3 ] = INTRA_DC           (8-17) - IfcandModeList[biggerIdx] − candModeList[ !biggerIdx] is equal to neither64 nor 1, the following app lies:  candModeList[ 4 ] = 2 + ( (candModeList[biggerIdx] + 62 ) % 65 )   (8-18)  candModeList[ 5 ] = 2 +( ( candModeList[biggerIdx] − 1 ) % 65 )   (8-19) - Otherwise, thefollowing applies:  candModeList[ 4 ] = 2 + ( (candModeList[biggerIdx] + 61 ) % 65 )   (8-20)  candModeList[ 5 ] = 2 +( candModeList[biggerIdx] % 65 )     (8-21) - Otherwise, if sum ofcandIntraPredModeA and candIntraPredModeB is larger or equal to 2, thefollowing applies: candModeList[ 2 ] = ! candModeList[ !biggerIdx]         (8-22) candModeList[ 3 ] = 2 + ( (candModeList[biggerIdx] + 62 ) % 65 )     (8-23) candModeList[ 4 ] = 2 +( ( candModeList[biggerIdx] − 1 ) % 65 )     (8-24) candModeList[ 5 ] =2 + ( ( candModeList[biggerIdx] + 61 ) % 65 )     (8-25) 4. IntraPredModeY[ xCb ][ yCb ] is derived by applying the followingprocedure:  - If intra_luma_mpm_flag[ xCb ][ yCb ] is equal to 1, theIntraPredModeY[ xCb ][ yCb ] is set equal to candMo deList[intra_luma_mpm_idx[ xCb ][ yCb ] ].  - Otherwise, IntraPredModeY[ xCb ][yCb ] is derived by applying the following ordered steps: 1. The arraycandModeList[ x ], x = 0..5 is modified by the following ordered steps: i. For i sequentially equals to 0 to 4, inclusive, apply:  ii. For jsequentially equals to i + 1 to 5, inclusive, compare candModeList[ i ]to candModeList[ j ], When candModeList[ i ] is greater thancandModeList[ j ], both values are swapped as follows:  ( candModeList[i ], candModeList[ j ] ) = Swap( candModeList[ i ], candModeList[ j])  (8-26) 2. IntraPredModeY[ xCb ][ yCb ] is derived by the followingordered steps:  i. IntraPredModeY[ xCb ][ yCb ] is set equal tointra_luma_mpm_remainder[ xCb ][ yCb ].  ii. For i equal to 0 to 5,inclusive, when IntraPredModeY[ xCb ][ yCb ] is greater than or equal tocandMo deList[ i ], the value of IntraPredModeY[ xCb ][ yCb ] isincremented by one. The variable IntraPredModeY[ x ][ y ] with x =xCb..xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1 is set to beequal to IntraPredModeY[ xCb ][ yCb ].

Referring to Table 24, candidate intra prediction modes may be derivedbased on neighboring blocks of the current block, and an MPM list forthe current block may be constructed based on the candidate intraprediction modes. The candidate intra prediction modes may include acandidate intra prediction mode A and a candidate intra prediction modeB.

For example, if at least one of the conditions described below is true(namely, if at least one of the conditions described below issatisfied), the candidate intra prediction mode A may be set to a planarintra prediction mode.

Neighboring block A is not available.

Intra prediction is not applied to the neighboring block A.

Here, the neighboring block A may be a left neighboring block of thecurrent block. The left neighboring block may be a left neighboringblock located at the lowermost side among left neighboring blocksadjacent to the current block. For example, if the size of the currentblock is cbWidthxcbHeight, x component of the top-left sample positionof the current position is xCb, and y component thereof is yCb, theneighboring block A may be a block including a sample at the coordinatesof (xCb−1, yCb+cbHeight−1). Meanwhile, the neighboring block A mayrepresent the neighboring block D.

If none of the conditions is true (namely, if none of the conditions issatisfied), the candidate intra prediction mode A may be set to theintra prediction mode of the neighboring block A.

Also, for example, if at least one among the conditions described belowis true (namely, if at least one among the conditions described below issatisfied), the candidate intra prediction mode B may be set to a planarintra prediction mode.

Neighboring block B is not available.

Intra prediction is not applied to the neighboring block B.

yCb−1 is smaller than ((yCb>>CtbLog2SizeY)<<CtbLog2SizeY).

Here, the neighboring block B may be an upper neighboring block of thecurrent block. The upper neighboring block may be an upper neighboringblock located at the rightmost side among upper neighboring blocksadjacent to the current block. For example, if the size of the currentblock is cbWidthxcbHeight, x component of the top-left sample positionof the current block is xCb, and y component thereof is yCb, theneighboring block B may be a block including a sample at the coordinatesof (xCb+cbWidth−1, yCb−1). Meanwhile, the CtbLog2SizeY may represent thesize of a current CTU, and ((yCb>>CtbLog2SizeY)<<CtbLog2SizeY) mayrepresent the coordinates of an upper boundary of the current CTU. Inother words, if yCb−1 is smaller than((yCb>>CtbLog2SizeY)<<CtbLog2SizeY), it may indicate the case where theneighboring block B leaves the range of the current CTU. In other words,the conditions described above may represent a case where theneighboring block leaves the range of the current CTU.

If none of the conditions is true (namely, if none of the conditions issatisfied), the candidate intra prediction mode B may be set to an intraprediction mode of the neighboring block B.

If the candidate intra prediction modes are derived, the MPM list of thecurrent block may be constructed as in the first MPM list. The first MPMlist may include a first MPM candidate representing the candidate intraprediction mode A, a second MPM candidate representing the intraprediction mode having a value obtained by applying the logical NOToperator to the candidate intra prediction mode A, a third MPM candidaterepresenting intra prediction mode 50, a fourth MPM candidaterepresenting intra prediction mode 18, a fifth MPM candidaterepresenting intra prediction mode 46, and a sixth MPM candidaterepresenting intra prediction mode 54.

Afterwards, whether the candidate intra prediction mode B is the same asthe candidate intra prediction mode A may be determined.

If the candidate intra prediction mode B is the same as the candidateintra prediction mode A, it may be determined whether the candidateintra prediction mode A is larger than 1.

If the candidate intra prediction mode A is larger than 1, the MPM listof the current block may be constructed like the second MPM list. Thesecond MPM list may include a first MPM candidate representing thecandidate intra prediction mode A, a second MPM candidate representing aplanar intra prediction mode, a third MPM candidate representing a DCintra prediction mode, a fourth MPM candidate representing an intraprediction mode derived as 2+((candIntraPredModeA+62) % 65), a fifth MPMcandidate representing an intra prediction mode derived as2+((candIntraPredModeA−1) % 65), and a sixth MPM candidate representingan intra prediction mode derived as 2+((candIntraPredModeA+61) % 65).

Meanwhile, if the candidate intra prediction mode B is not the same asthe candidate intra prediction mode A, the first MPM candidate and thesecond MPM candidate of the current block may be derived first, and thefirst MPM candidate may be derived as the candidate intra predictionmode A while the second MPM candidate may be derived as the candidateintra prediction mode B.

Afterwards, biggerIdx may be configured. Referring to Table 24, if thefirst MPM candidate is larger than the second MPM candidate, thebiggerIdx may be derived as 0, and if the first MPM candidate is notlarger than the second MPM candidate, the biggerIdx may be derived as 1.

Next, it may be determined whether the candidate intra prediction mode Aand the candidate intra prediction mode B are larger than 1 (namely, itmay be determined whether the mode number of the candidate intraprediction mode A and the mode number of the candidate intra predictionmode B are larger than 1).

If the candidate intra prediction mode A and the candidate intraprediction mode B are larger than 1, the third MPM candidate and thefourth MPM candidate of the current block may be derived, where thethird MPM candidate may be derived as a planar intra prediction mode,and the fourth MPM candidate may be derived as a DC intra predictionmode.

Next, it may be determined whether a difference (diff) between an MPMcandidate indicated by an MPM index having the biggerIdx value and anMPM candidate indicated by an MPM index having a value obtained byapplying the logical NOT operator to the biggerIdx (namely, !biggerIdx)is 1 or 64.

If the difference is 1 or 64, the fifth MPM candidate and the sixth MPMcandidate of the current block may be derived, where the fifth MPMcandidate may be derived as an intra prediction mode indicated by2+((candModeList[biggerIdx]+62) % 65), and the sixth MPM candidate maybe derived as an intra prediction mode indicated by2+((candModeList[biggerIdx]−1) % 65).

Or, if the difference is not 1 and is not 64, the fifth MPM candidateand the sixth MPM candidate of the current block may be derived, wherethe fifth MPM candidate may be derived as an intra prediction modeindicated by 2+((candModeList[biggerIdx]+61) % 65), and the sixth MPMcandidate may be derived as an intra prediction mode indicated by2+(candModeList[biggerIdx] % 65).

Meanwhile, if a sum of the candidate intra prediction mode A and thecandidate intra prediction mode B is larger than or equal to 2, thethird MPM candidate, the fourth MPM candidate, the fifth MPM candidate,and the sixth MPM candidate of the current block may be derived; thethird MPM candidate may be derived as an intra prediction mode having avalue obtained by applying the logical NOT operator to the MPM candidateindicated by the MPM index having the value obtained by applying thelogical NOT operator (namely, !biggerIdx) to the biggerIdx; the fourthMPM candidate may be derived as an intra prediction mode indicated by2+((candModeList[biggerIdx]+62) % 65); the fifth MPM candidate may bederived as an intra prediction mode indicated by2+((candModeList[biggerIdx]−1) % 65); and the sixth MPM candidate may bederived as an intra prediction mode indicated by2+((candModeList[biggerId]+61) % 65).

FIG. 22 illustrates an image encoding method performed by an encodingapparatus according to the present disclosure. The method disclosed inFIG. 22 may be performed by the encoding apparatus disclosed in FIG. 2 .More specifically, for example, the S2200 to S2230 steps of FIG. 22 maybe performed by the predictor of the encoding apparatus, and the S2240step may be performed by the entropy encoder of the encoding apparatus.Also, although not shown in the figure, a process for deriving residualsamples for the current block based on original samples and predictionsamples of the current block may be performed by the subtractor of theencoding apparatus; a process for generating information about residualsfor the current block based on the residual samples may be performed bythe transformer of the encoding apparatus; and a process for encodingimage information including information about the residuals may beperformed by the entropy encoder of the encoding apparatus.

The encoding apparatus derives candidate intra prediction modes based onneighboring blocks of a current block S2200. The encoding apparatus mayderive candidate intra prediction modes based on the neighboring blocksof the current block. Here, the neighboring blocks may include a firstneighboring block and a second neighboring block of the current block,and the candidate intra prediction modes may include a first candidateintra prediction mode and a second candidate intra prediction mode.Also, for example, the first neighboring block may be a left neighboringblock located at the lowermost side among neighboring blocks adjacent tothe left boundary of the current block, and the second neighboring blockmay be an upper neighboring block located at the rightmost side amongneighboring blocks adjacent to the upper boundary of the current block.If the size of the current block is W×H, x component of the top-leftsample position of the current block is xN, and y component thereof isyN, the first neighboring block may be a block containing a sample atthe coordinates of (xN−1, H+yN−1), and the second neighboring block maybe a block containing a sample at the coordinates of (W+xN−1, yN−1).

As one example, the first candidate intra prediction mode may be derivedbased on the first neighboring block, and the second candidate intraprediction mode may be derived based on the second neighboring block. Inother words, the candidate intra prediction modes may be derived basedon the first neighboring block and the second neighboring block.

For example, if the first neighboring block is available, and intraprediction is applied to the first neighboring block, the firstcandidate intra prediction mode may be derived as an intra predictionmode of the first neighboring block, and if the first neighboring blockis unavailable, or the intra prediction is not applied to the firstneighboring block, the first candidate intra prediction mode may bederived as a planar intra prediction mode.

Also, for example, if the second neighboring block is available, intraprediction is applied to the second neighboring block, and a current CTUcontains the second neighboring block, the second candidate intraprediction mode may be derived as an intra prediction mode of the secondneighboring block, and if the second neighboring block is unavailable,the intra prediction is not applied to the second neighboring block, orthe current CTU does not contain the second neighboring block, thesecond candidate intra prediction mode may be derived as a planar intraprediction mode.

The encoding apparatus constructs a Most Probable Mode (MPM) list of thecurrent block based on the candidate intra prediction modes S2210. Theencoding apparatus may construct the MPM list of the current block basedon the candidate intra prediction modes.

For example, the encoding apparatus may determine whether the firstcandidate intra prediction mode is the same as the second candidateintra prediction mode.

If the first candidate intra prediction mode is the same as the secondcandidate intra prediction mode, the encoding apparatus may determinewhether the mode number of the first candidate intra prediction mode islarger than the mode number of a DC intra prediction mode.

If the mode number of the first intra prediction mode is larger than themode number of the DC intra prediction mode, the encoding apparatus mayderive the MPM list of the current block as a first MPM list. Here, forexample, the first MPM list may include 6 MPM candidates. The MPMcandidates may include a first MPM candidate, a second MPM candidate, athird MPM candidate, a fourth MPM candidate, a fifth MPM candidate, anda sixth MPM candidate. The first MPM list may include the MPM candidatesin the order of the first, the second, the third, the fourth, the fifth,and the sixth MPM candidate. In other words, the first MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 0, the secondMPM candidate may represent an MPM candidate indicated by an MPM indexof 1, the third MPM candidate may represent an MPM candidate indicatedby an MPM index of 2, the fourth MPM candidate may represent an MPMcandidate indicated by an MPM index of 3, the fifth MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 4, and the sixthMPM candidate may represent an MPM candidate indicated by an MPM indexof 5.

Here, for example, the first MPM candidate may be derived as the firstcandidate intra prediction mode, the second MPM candidate may be derivedas an intra prediction mode indicated by a value obtained by subtracting1 from the mode number of the first candidate intra prediction modeaccording to modular arithmetic, the third MPM candidate may be derivedas an intra prediction mode indicated by a value obtained by adding 1 tothe mode number of the first candidate intra prediction mode accordingto modular arithmetic, the fourth MPM candidate may be derived as anintra prediction mode indicated by a value obtained by subtracting 2from the mode number of the first intra prediction mode according tomodular arithmetic, the fifth MPM candidate may be derived as a planarintra prediction mode, and the sixth MPM candidate may be derived as aDC intra prediction mode.

Or, for example, the first MPM candidate may be derived as the firstcandidate intra prediction mode, the second MPM candidate may be derivedas a planar intra prediction mode, the third MPM candidate may bederived as a DC intra prediction mode, the fourth MPM candidate may bederived as an intra prediction mode indicated by a value obtained bysubtracting 1 from the mode number of the first candidate intraprediction mode according to modular arithmetic, the fifth MPM candidatemay be derived as an intra prediction mode indicated by a value obtainedby adding 1 to the mode number of the first candidate intra predictionmode according to modular arithmetic, and the sixth MPM candidate may bederived as an intra prediction mode indicated by a value obtained bysubtracting 2 from the mode number of the first intra prediction modeaccording to modular arithmetic.

Also, if the mode number of the first intra prediction mode is notlarger than the mode number of the DC intra prediction mode, theencoding apparatus may derive the MPM list of the current block as asecond MPM list. Here, for example, the second MPM list may include 6MPM candidates. The MPM candidates may include a first MPM candidate, asecond MPM candidate, a third MPM candidate, a fourth MPM candidate, afifth MPM candidate, and a sixth MPM candidate. The second MPM list mayinclude the MPM candidates in the order of the first, the second, thethird, the fourth, the fifth, and the sixth MPM candidate. In otherwords, the first MPM candidate may represent an MPM candidate indicatedby an MPM index of 0, the second MPM candidate may represent an MPMcandidate indicated by an MPM index of 1, the third MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 2, the fourthMPM candidate may represent an MPM candidate indicated by an MPM indexof 3, the fifth MPM candidate may represent an MPM candidate indicatedby an MPM index of 4, and the sixth MPM candidate may represent an MPMcandidate indicated by an MPM index of 5.

Here, for example, the first MPM candidate may be derived as a planarintra prediction mode, the second MPM candidate may be derived as a DCintra prediction mode, the third MPM candidate may be derived as avertical intra prediction mode (namely, intra prediction mode 50), thefourth MPM candidate may be derived as a horizontal intra predictionmode (namely, intra prediction mode 18), the fifth MPM candidate may bederived as a horizontal diagonal intra prediction mode (namely, intraprediction mode 46), and the sixth MPM candidate may be derived as avertical diagonal intra prediction mode (namely, intra prediction mode54).

Meanwhile, if the first candidate intra prediction mode is not the sameas the second candidate intra prediction mode, the encoding apparatusmay derive the MPM list based on whether the mode number of the firstcandidate intra prediction mode and the mode number of the secondcandidate intra prediction mode are larger than the mode number of theDC intra prediction mode. Also, if the first candidate intra predictionmode is not the same as the second candidate intra prediction mode, thelargest candidate intra prediction mode and the smallest candidate intraprediction mode may be derived among the candidate intra predictionmodes. Among the candidate intra prediction modes, a candidate intraprediction mode having a large mode number may be derived as the largestcandidate intra prediction mode while a candidate intra prediction modehaving a small mode number may be derived as the smallest candidateintra prediction mode. Also, if the first candidate intra predictionmode is not the same as the second candidate intra prediction mode, thefirst MPM candidate of the MPM list may be derived as the firstcandidate intra prediction mode, and the second MPM candidate of the MPMlist may be derived as the second candidate intra prediction mode. Theremaining MPM candidates of the MPM list may be derived based on whetherthe mode number of the first candidate intra prediction mode and themode number of the second candidate intra prediction mode are largerthan the mode number of the DC intra prediction mode.

Also, for example, if the mode number of the first candidate intraprediction mode and the mode number of the second candidate intraprediction mode are larger than the mode number of the DC intraprediction mode, the third MPM candidate of the MPM list may be derivedas the planar intra prediction mode, the fourth MPM candidate of the MPMlist may be derived as the DC intra prediction mode, and the fifth MPMcandidate and the sixth MPM candidate of the MPM list may be derivedbased on a difference between the mode number of the largest candidateintra prediction mode and the mode number of the smallest candidateintra prediction mode. If a difference between the mode number of thelargest candidate intra prediction mode and the mode number of thesmallest candidate intra prediction mode is not 1 and is not 64, thefifth MPM candidate of the MPM list may be derived as an intraprediction mode indicated by a value obtained by subtracting 1 from themode number of the first candidate intra prediction mode according tomodular arithmetic, and the sixth MPM candidate of the MPM list may bederived as an intra prediction mode indicated by a value obtained byadding 1 to the mode number of the first candidate intra prediction modeaccording to modular arithmetic. Also, if a difference between the modenumber of the largest candidate intra prediction mode and the modenumber of the smallest candidate intra prediction mode is 1 or 64, thefifth MPM candidate of the MPM list may be derived as an intraprediction mode indicated by a value obtained by subtracting 2 from themode number of the first candidate intra prediction mode according tomodular arithmetic, and the sixth MPM candidate of the MPM list may bederived as an intra prediction mode indicated by a value obtained byadding 2 to the mode number of the first candidate intra prediction modeaccording to modular arithmetic.

Also, for example, if one of the mode number of the first candidateintra prediction mode and the mode number of the second candidate intraprediction mode is larger than the mode number of the DC intraprediction mode, the third MPM candidate of the MPM list may be derivedas an intra prediction mode indicated by a value obtained by applyingthe logical NOT operator to the smallest candidate intra predictionmode, the fourth MPM candidate of the MPM list may be derived as thevertical intra prediction mode (namely, intra prediction mode 50), thefifth MPM candidate of the MPM list may be derived as an intraprediction mode indicated by a value obtained by subtracting 4 from themode number of the vertical intra prediction mode, and the sixth MPMcandidate of the MPM list may be derived as an intra prediction modeindicated by a value obtained by adding 4 to the mode number of thevertical intra prediction mode.

Also, for example, if the mode number of the first candidate intraprediction mode and the mode number of the second candidate intraprediction mode are not larger than the mode number of the DC intraprediction mode, the encoding apparatus may derive the MPM list of thecurrent block as a second MPM list. Here, for example, the second MPMlist may include 6 MPM candidates. For example, the first MPM candidatemay be derived as a planar intra prediction mode, the second MPMcandidate may be derived as a DC intra prediction mode, the third MPMcandidate may be derived as the vertical intra prediction mode (namely,intra prediction mode 50), the fourth MPM candidate may be derived asthe horizontal intra prediction mode (namely, intra prediction mode 18),the fifth MPM candidate may be derived as the horizontal diagonal intraprediction mode (namely, intra prediction mode 46), and the sixth MPMcandidate may be derived as the vertical diagonal intra prediction mode(namely, intra prediction mode 54).

Meanwhile, the MPM candidates may include a first MPM candidate, asecond MPM candidate, a third MPM candidate, a fourth MPM candidate, afifth MPM candidate, and a sixth MPM candidate. The first MPM list mayinclude the MPM candidates in the order of the first, the second, thethird, the fourth, the fifth, and the sixth MPM candidate. In otherwords, the first MPM candidate may represent an MPM candidate indicatedby an MPM index of 0, the second MPM candidate may represent an MPMcandidate indicated by an MPM index of 1, the third MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 2, the fourthMPM candidate may represent an MPM candidate indicated by an MPM indexof 3, the fifth MPM candidate may represent an MPM candidate indicatedby an MPM index of 4, and the sixth MPM candidate may represent an MPMcandidate indicated by an MPM index of 5.

The encoding apparatus determines an intra prediction mode for thecurrent block S2220. The encoding apparatus may derive an intraprediction mode having the optimal RD costs as an intra prediction modefor the current block by performing various intra prediction modes. Theintra prediction mode may be one of two non-directional intra predictionmodes and 65 directional intra prediction modes. As described above, thetwo non-directional intra prediction modes include the intra DC mode andthe intra planar mode.

The encoding apparatus may generate an MPM flag indicating whether thedetermined intra prediction mode is included in the MPM candidates ofthe MPM list. If the determined intra prediction mode is included in theMPM candidates of the MPM list, the encoding apparatus may generate anMPM index indicating the determined intra prediction mode among the MPMcandidates. If the determined intra prediction mode is not included inthe MPM candidates of the MPM list, the encoding apparatus may generateremaining intra prediction mode information indicating the determinedintra prediction mode among the remaining intra prediction modes notincluded in the MPM candidates. Meanwhile, the determined intraprediction mode is included in the MPM candidates of the MPM list, theencoding apparatus may not signal the MPM flag, and the value of the MPMflag may be derived as 1. The intra prediction mode information for thecurrent block may include the MPM flag, the MPM index and/or theremaining intra prediction mode information.

The encoding apparatus generates a prediction sample for the currentblock based on the intra prediction mode S2230. The encoding apparatusmay derive, based on the intra prediction mode, at least one neighboringsample among neighboring samples of the current block and based on theneighboring sample, generate the prediction sample. The neighboringsamples may include a top-left corner neighboring sample, upperneighboring samples, and left neighboring samples of the current block.For example, if the size of the current block is W×H, x component of thetop-left sample position of the current block is xN, and y componentthereof is yN, the left neighboring samples may be p[xN−1][yN] top[xN−1][2H+yN−1], the top-left corner neighboring sample may bep[xN−1][yN−1], the upper neighboring samples may be p[xN][yN−1] top[2W+xN−1][yN−1].

The encoding apparatus encodes image information including intraprediction mode information for the current block S2240. The encodingapparatus may encode image information including the intra predictionmode information for the current block and output the encoded imageinformation in the form of a bitstream. The intra prediction modeinformation may include the MPM flag, the MPM index and/or the remainingintra prediction mode information. Also, although not shown in thefigure, the encoding apparatus may derive residual samples for thecurrent block based on original samples and prediction samples of thecurrent block, generate information about residuals for the currentblock based on the residual samples, encode image information includinginformation about the residuals, and output the encoded imageinformation in the form of a bitstream. Meanwhile, the bitstream may betransmitted to the decoding apparatus via a network or a (digital)storage medium. Here, the network may include a broadcast network and/orcommunication network, and the digital storage medium may includevarious types of storage media such as USB, SD, CD, DVD, Bluray, HDD,and SSD.

FIG. 23 illustrates an encoding apparatus performing an image encodingmethod according to the present disclosure. The method disclosed in FIG.22 may be performed by the encoding apparatus disclosed in FIG. 23 .More specifically, the predictor of the encoding apparatus of FIG. 23may perform the S2200 to S2230 steps of FIG. 22 , and the entropyencoder of the encoding apparatus of FIG. 23 may perform the S2240 stepof FIG. 22 . Also, although not shown in the figure, a process forderiving residual samples for the current block based on originalsamples and prediction samples of the current block may be performed bythe subtractor of the encoding apparatus of FIG. 23 ; a process forgenerating information about residuals for the current block based onthe residual samples may be performed by the transformer of the encodingapparatus of FIG. 23 ; and a process for encoding image informationincluding information about the residuals may be performed by theentropy encoder of the encoding apparatus of FIG. 23 .

FIG. 24 illustrates an image decoding method performed by an imagedecoding apparatus according to the present disclosure. The methoddisclosed in FIG. 24 may be performed by the decoding apparatusdisclosed in FIG. 3 . More specifically, the S2400 to S2430 steps ofFIG. 24 may be performed by the predictor of the decoding apparatus.Also, although not shown in the figure, a process for obtaining intraprediction mode information and image information including residualsfor the current block through a bitstream may be performed by theentropy decoder of the decoding apparatus, a process for deriving theresidual samples for the current block based on the residual informationmay be performed by the inverse transformer of the decoding apparatus,and a process for generating a reconstructed picture based on theprediction samples and the residual samples may be performed by theadder of the decoding apparatus.

The decoding apparatus may derive candidate intra prediction modes basedon neighboring blocks of a current block S2400. The decoding apparatusmay derive candidate intra prediction modes based on the neighboringblocks of the current block. Here, the neighboring block may include afirst neighboring block and a second neighboring block of the currentblock; and the candidate intra prediction modes may include a firstcandidate intra prediction mode and a second candidate intra predictionmode. Also, for example, the first neighboring block may be a leftneighboring block located at the lowermost side among neighboring blocksadjacent to a left boundary of the current block, and the secondneighboring block may be an upper neighboring block located at therightmost side among neighboring blocks adjacent to an upper boundary ofthe current block. If the size of the current block is W×H, x componentof the top-left sample position of the current block is xN, and ycomponent thereof is yN, the first neighboring block may be blockincluding a sample at the coordinates of (xN−1, H+yN−1), and the secondneighboring block may be a block including a sample at the coordinatesof (W+xN−1, yN−1).

As one example, the first candidate intra prediction mode may be derivedbased on the first neighboring block, and the second candidate intraprediction mode may be derived based on the second neighboring block. Inother words, the candidate intra prediction modes may be derived basedonly on the first neighboring block and the second neighboring block.

For example, if the first neighboring block is available, and intraprediction is applied to the first neighboring block, the firstcandidate intra prediction mode may be derived as an intra predictionmode of the first neighboring block, and if the first neighboring blockis unavailable, or the intra prediction is not applied to the firstneighboring block, the first candidate intra prediction mode may bederived as a planar intra prediction mode.

Also, for example, if the second neighboring block is available, intraprediction is applied to the second neighboring block, and a current CTUcontains the second neighboring block, the second candidate intraprediction mode may be derived as an intra prediction mode of the secondneighboring block, and if the second neighboring block is unavailable,the intra prediction is not applied to the second neighboring block, orthe current CTU does not contain the second neighboring block, thesecond candidate intra prediction mode may be derived as a planar intraprediction mode.

The decoding apparatus constructs a Most Probable Mode (MPM) list of thecurrent block based on the candidate intra prediction modes S2410. Thedecoding apparatus may construct the MPM list of the current block basedon the candidate intra prediction modes.

For example, the decoding apparatus may determine whether the firstcandidate intra prediction mode is the same as the second candidateintra prediction mode.

If the first candidate intra prediction mode is the same as the secondcandidate intra prediction mode, the decoding apparatus may determinewhether the mode number of the first intra prediction mode is largerthan the mode number of a DC intra prediction mode.

If the mode number of the first intra prediction mode is larger than themode number of the DC intra prediction mode, the decoding apparatus mayderive the MPM list of the current block as a first MPM list. Here, forexample, the first MPM list may include 6 MPM candidates. The MPMcandidates may include a first MPM candidate, a second MPM candidate, athird MPM candidate, a fourth MPM candidate, a fifth MPM candidate, anda sixth MPM candidate. The first MPM list may include the MPM candidatesin the order of the first, the second, the third, the fourth, the fifth,and the sixth MPM candidate. In other words, the first MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 0, the secondMPM candidate may represent an MPM candidate indicated by an MPM indexof 1, the third MPM candidate may represent an MPM candidate indicatedby an MPM index of 2, the fourth MPM candidate may represent an MPMcandidate indicated by an MPM index of 3, the fifth MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 4, and the sixthMPM candidate may represent an MPM candidate indicated by an MPM indexof 5.

Here, for example, the first MPM candidate may be derived as the firstcandidate intra prediction mode, the second MPM candidate may be derivedas an intra prediction mode indicated by a value obtained by subtracting1 from the mode number of the first candidate intra prediction modeaccording to modular arithmetic, the third MPM candidate may be derivedas an intra prediction mode indicated by a value obtained by adding 1 tothe mode number of the first candidate intra prediction mode accordingto modular arithmetic, the fourth MPM candidate may be derived as anintra prediction mode indicated by a value obtained by subtracting 2from the mode number of the first intra prediction mode according tomodular arithmetic, the fifth MPM candidate may be derived as a planarintra prediction mode, and the sixth MPM candidate may be derived as aDC intra prediction mode.

Or, for example, the first MPM candidate may be derived as the firstcandidate intra prediction mode, the second MPM candidate may be derivedas a planar intra prediction mode, the third MPM candidate may bederived as a DC intra prediction mode, the fourth MPM candidate may bederived as an intra prediction mode indicated by a value obtained bysubtracting 1 from the mode number of the first candidate intraprediction mode according to modular arithmetic, the fifth MPM candidatemay be derived as an intra prediction mode indicated by a value obtainedby adding 1 to the mode number of the first candidate intra predictionmode according to modular arithmetic, and the sixth MPM candidate may bederived as an intra prediction mode indicated by a value obtained bysubtracting 2 from the mode number of the first intra prediction modeaccording to modular arithmetic.

Also, if the mode number of the first intra prediction mode is notlarger than the mode number of the DC intra prediction mode, thedecoding apparatus may derive the MPM list of the current block as asecond MPM list. Here, for example, the second MPM list may include 6MPM candidates. The MPM candidates may include a first MPM candidate, asecond MPM candidate, a third MPM candidate, a fourth MPM candidate, afifth MPM candidate, and a sixth MPM candidate. The second MPM list mayinclude the MPM candidates in the order of the first, the second, thethird, the fourth, the fifth, and the sixth MPM candidate. In otherwords, the first MPM candidate may represent an MPM candidate indicatedby an MPM index of 0, the second MPM candidate may represent an MPMcandidate indicated by an MPM index of 1, the third MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 2, the fourthMPM candidate may represent an MPM candidate indicated by an MPM indexof 3, the fifth MPM candidate may represent an MPM candidate indicatedby an MPM index of 4, and the sixth MPM candidate may represent an MPMcandidate indicated by an MPM index of 5.

Here, for example, the first MPM candidate may be derived as a planarintra prediction mode, the second MPM candidate may be derived as a DCintra prediction mode, the third MPM candidate may be derived as avertical intra prediction mode (namely, intra prediction mode 50), thefourth MPM candidate may be derived as a horizontal intra predictionmode (namely, intra prediction mode 18), the fifth MPM candidate may bederived as a horizontal diagonal intra prediction mode (namely, intraprediction mode 46), and the sixth MPM candidate may be derived as avertical diagonal intra prediction mode (namely, intra prediction mode54).

Meanwhile, if the first candidate intra prediction mode is not the sameas the second candidate intra prediction mode, the decoding apparatusmay derive the MPM list based on whether the mode number of the firstcandidate intra prediction mode and the mode number of the secondcandidate intra prediction mode are larger than the mode number of theDC intra prediction mode. Also, if the first candidate intra predictionmode is not the same as the second candidate intra prediction mode, thelargest candidate intra prediction mode and the smallest candidate intraprediction mode may be derived among the candidate intra predictionmodes. Among the candidate intra prediction modes, a candidate intraprediction mode having a large mode number may be derived as the largestcandidate intra prediction mode while a candidate intra prediction modehaving a small mode number may be derived as the smallest candidateintra prediction mode. Also, if the first candidate intra predictionmode is not the same as the second candidate intra prediction mode, thefirst MPM candidate of the MPM list may be derived as the firstcandidate intra prediction mode, and the second MPM candidate of the MPMlist may be derived as the second candidate intra prediction mode. Theremaining MPM candidates of the MPM list may be derived based on whetherthe mode number of the first candidate intra prediction mode and themode number of the second candidate intra prediction mode are largerthan the mode number of the DC intra prediction mode.

Also, for example, if the mode number of the first candidate intraprediction mode and the mode number of the second candidate intraprediction mode are larger than the mode number of the DC intraprediction mode, the third MPM candidate of the MPM list may be derivedas the planar intra prediction mode, the fourth MPM candidate of the MPMlist may be derived as the DC intra prediction mode, and the fifth MPMcandidate and the sixth MPM candidate of the MPM list may be derivedbased on a difference between the mode number of the largest candidateintra prediction mode and the mode number of the smallest candidateintra prediction mode. If a difference between the mode number of thelargest candidate intra prediction mode and the mode number of thesmallest candidate intra prediction mode is not 1 and is not 64, thefifth MPM candidate of the MPM list may be derived as an intraprediction mode indicated by a value obtained by subtracting 1 from themode number of the first candidate intra prediction mode according tomodular arithmetic, and the sixth MPM candidate of the MPM list may bederived as an intra prediction mode indicated by a value obtained byadding 1 to the mode number of the first candidate intra prediction modeaccording to modular arithmetic. Also, if a difference between the modenumber of the largest candidate intra prediction mode and the modenumber of the smallest candidate intra prediction mode is 1 or 64, thefifth MPM candidate of the MPM list may be derived as an intraprediction mode indicated by a value obtained by subtracting 2 from themode number of the first candidate intra prediction mode according tomodular arithmetic, and the sixth MPM candidate of the MPM list may bederived as an intra prediction mode indicated by a value obtained byadding 2 to the mode number of the first candidate intra prediction modeaccording to modular arithmetic.

Also, for example, if one of the mode number of the first candidateintra prediction mode and the mode number of the second candidate intraprediction mode is larger than the mode number of the DC intraprediction mode, the third MPM candidate of the MPM list may be derivedas an intra prediction mode indicated by a value obtained by applyingthe logical NOT operator to the smallest candidate intra predictionmode, the fourth MPM candidate of the MPM list may be derived as thevertical intra prediction mode (namely, intra prediction mode 50), thefifth MPM candidate of the MPM list may be derived as an intraprediction mode indicated by a value obtained by subtracting 4 from themode number of the vertical intra prediction mode, and the sixth MPMcandidate of the MPM list may be derived as an intra prediction modeindicated by a value obtained by adding 4 to the mode number of thevertical intra prediction mode.

Also, for example, if the mode number of the first candidate intraprediction mode and the mode number of the second candidate intraprediction mode are not larger than the mode number of the DC intraprediction mode, the decoding apparatus may derive the MPM list of thecurrent block as a second MPM list. Here, for example, the second MPMlist may include 6 MPM candidates. For example, the first MPM candidatemay be derived as a planar intra prediction mode, the second MPMcandidate may be derived as a DC intra prediction mode, the third MPMcandidate may be derived as the vertical intra prediction mode (namely,intra prediction mode 50), the fourth MPM candidate may be derived asthe horizontal intra prediction mode (namely, intra prediction mode 18),the fifth MPM candidate may be derived as the horizontal diagonal intraprediction mode (namely, intra prediction mode 46), and the sixth MPMcandidate may be derived as the vertical diagonal intra prediction mode(namely, intra prediction mode 54).

Meanwhile, the MPM candidates may include a first MPM candidate, asecond MPM candidate, a third MPM candidate, a fourth MPM candidate, afifth MPM candidate, and a sixth MPM candidate. The first MPM list mayinclude the MPM candidates in the order of the first, the second, thethird, the fourth, the fifth, and the sixth MPM candidate. In otherwords, the first MPM candidate may represent an MPM candidate indicatedby an MPM index of 0, the second MPM candidate may represent an MPMcandidate indicated by an MPM index of 1, the third MPM candidate mayrepresent an MPM candidate indicated by an MPM index of 2, the fourthMPM candidate may represent an MPM candidate indicated by an MPM indexof 3, the fifth MPM candidate may represent an MPM candidate indicatedby an MPM index of 4, and the sixth MPM candidate may represent an MPMcandidate indicated by an MPM index of 5.

The decoding apparatus derives an intra prediction mode for the currentblock based on the MPM list S2420.

As one example, the decoding apparatus may derive an MPM flag for thecurrent block. For example, the decoding apparatus may obtain intraprediction mode information for the current block from a bitstream,where the intra prediction mode information may include the MPM flag forthe current block. Or, the intra prediction mode information may notinclude the MPM flag, and in this case, the decoding apparatus mayderive the value of the MPM flag as 1.

If the MPM flag is 1, the decoding apparatus may derive an MPM candidateindicated by an MPM index among MPM candidates of the MPM list as theintra prediction mode for the current block. The intra prediction modeinformation may include the MPM index. The MPM index may be signaled inthe form of mpm_idx or intra_luma_mpm_idx syntax element.

If the MPM flag is not 0, the decoding apparatus may derive an intraprediction mode indicated by remaining intra prediction mode informationamong the remaining intra prediction modes as the intra prediction modefor the current block. The remaining intra prediction modes mayrepresent the remaining intra prediction modes not included in the MPMcandidates. The intra prediction mode information may include theremaining intra prediction mode information. The remaining intraprediction mode information may be signaled in the form ofrem_intra_luma_pred_mode or intra_luma_mpm_remainder syntax element.

Here, the neighboring samples may include a top-left corner neighboringsample, upper neighboring samples, and left neighboring samples of thecurrent block. For example, if the size of the current block is W×H, xcomponent of the top-left sample position of the current block is xN,and y component thereof is yN, the left neighboring samples may bep[xN−1][yN] to p[xN−1][2H+yN−1], the top-left corner neighboring samplemay be p[xN−1][yN−1], the upper neighboring samples may be p[xN][yN−1]to p[2W+xN−1][yN−1].

The decoding apparatus generates a prediction sample for the currentblock based on the intra prediction mode S2430. The decoding apparatusmay derive, based on the intra prediction mode, at least one neighboringsample among neighboring samples of the current block and based on theneighboring sample, generate the prediction sample. The neighboringsamples may include a top-left corner neighboring sample, upperneighboring samples, and left neighboring samples of the current block.For example, if the size of the current block is W×H, x component of thetop-left sample position of the current block is xN, and y componentthereof is yN, the left neighboring samples may be p[xN−1][yN] top[xN−1][2H+yN−1], the top-left corner neighboring sample may bep[xN−1][yN−1], the upper neighboring samples may be p[xN][yN−1] top[2W+xN−1][yN−1].

Meanwhile, although not shown in the figure, the decoding apparatus maydirectly use the prediction samples as reconstructed samples accordingto a prediction mode or may generate reconstructed samples by addingresidual samples to the prediction samples. In the existence of residualsamples for the current block, the decoding apparatus may receiveinformation about residuals for the current block, and the informationabout the residuals may be included in the information about the phase.The information about the residuals may include transform coefficientsabout the residual samples. The decoding apparatus may derive theresidual samples (or a residual sample array) for the current blockbased on the residual information. The decoding apparatus may generatereconstructed samples based on the prediction samples and the residualsamples and derive a reconstructed block or a reconstructed picturebased on the reconstructed samples. Afterwards, depending on the needs,the decoding apparatus may apply a deblocking filtering process and/oran in-loop filtering process such as the SAO process to thereconstructed picture to improve subjective/objective image quality asdescribed above.

FIG. 25 illustrates a decoding apparatus performing an image decodingmethod according to the present disclosure. The method disclosed in FIG.24 may be performed by the decoding apparatus disclosed in FIG. 25 .More specifically, the predictor of the decoding apparatus of FIG. 25may perform the S2400 to S2430 steps of FIG. 24 . Also, although notshown in the figure, a process for obtaining image information includingintra prediction mode information and/or information about residuals forthe current block through a bitstream may be performed by the entropydecoder of the decoding apparatus of FIG. 25 , a process for derivingthe residual samples for the current block based on the residualinformation may be performed by the inverse transformer of the decodingapparatus of FIG. 25 , and a process for generating a reconstructedpicture based on the prediction samples and the residual samples may beperformed by the adder of the decoding apparatus of FIG. 25 .

According to the present disclosure, an MPM list for the current blockmay be constructed by considering the increase of the number of intraprediction modes, through which accuracy of the MPM list forrepresenting an intra prediction mode of the current block may beimproved, and the overall coding efficiency may be improved.

Also, according to the present disclosure, complicated computations maybe reduced, and an MPM list including a plurality of MPM candidates maybe constructed based on candidate intra prediction modes derived fromneighboring blocks, through which computational complexity of a processfor representing an intra prediction mode of a current block may bereduced, and the overall coding efficiency may be improved.

In the embodiments described above, methods are described according to aflow diagram by using a series of steps and blocks. However, the presentdisclosure is not limited to a specific order of the steps, and somesteps may be performed with different steps and in a different orderfrom those described above or simultaneously. Also, it should beunderstood by those skilled in the art that the steps shown in the flowdiagram are not exclusive, other steps may be further included, or oneor more steps of the flow diagram may be deleted without influencing thetechnical scope of the present disclosure.

The method according to the present disclosure may be implemented in theform of software, and the encoding apparatus and/or decoding apparatusaccording to the present disclosure may be included in an apparatus thatperforms image processing, such as TV, computer, smartphone, set-topbox, and display device.

When embodiments of the present disclosure are implemented by software,the aforementioned method may be implemented by a module (process orfunction) that performs the aforementioned function. The module may bestored in a memory and executed by a processor. The memory may belocated inside or outside of the processor and may be connected to theprocessor via various well-known means. The processor may includeApplication-Specific Integrated Circuit (ASIC), other chipset, logicalcircuit and/or data processing device. The memory may include Read-OnlyMemory (ROM), Random Access Memory (RAM), flash memory, memory card,storage medium and/or other storage device. In other words, embodimentsaccording to the present disclosure may be implemented and performed ona processor, micro-processor, controller, or chip. For example, functionunits illustrated in each drawing may be implemented and performed on acomputer, processor, micro-processor, controller, or chip. In this case,information (for example, information on instructions) or algorithm forimplementation may be stored in a digital storage medium.

Also, the decoding apparatus and the encoding apparatus to which thepresent disclosure is applied may include a multimedia broadcasttransmission and reception device, mobile communication terminal, homecinema video device, digital cinema video device, surveillance camera,video communication device, real-time communication device for videocommunication, mobile streaming device, storage medium, camcorder, videoon demand (VoD) service provision device, Over the top (OTT) videodevice, Internet streaming service provision device, 3D video device,virtual reality (VR) device, augmented reality (AR) device, video phonedevice, transportation means terminal (for example, vehicle (includingself-driving vehicles) terminal, airplane terminal, and ship terminal),and medical video device; and may be used for processing a video signalor a data signal. For example, OTT video devices may include a gameconsole, Bluray player, Internet connection TV, home theater system,smartphone, tablet PC, and digital video recorder (DVR).

Also, a processing method to which the present disclosure is applied maybe produced in the form of a program executed by a computer and may bestored in a computer-readable recording medium. Multimedia data having adata structure according to the present disclosure may also be stored ina computer-readable recording medium. The computer-readable recordingmedium includes all kinds of storage devices and distributed storagedevices in which computer-readable data are stored. Thecomputer-readable recording medium may include, for example, a Bluraydisk (BD), universal serial bus (USB), ROM, PROM, EPROM, EEPROM, RAM,CD-ROM, magnetic tape, floppy disk, and optical data storage device.Also, the computer-readable recording medium includes a mediaimplemented in the form of a carrier (for example, transmission throughthe Internet). Also, a bitstream generated according to the encodingmethod may be stored in a computer-readable recording medium ortransmitted through a wired or wireless communication network.

Also, the embodiment of the present disclosure may be implemented as acomputer program product in the form of program code, and the programcode may be executed by a computer according to the embodiment of thepresent disclosure. The program code may be stored on acomputer-readable carrier.

FIG. 26 illustrates an example of a contents streaming system to whichthe present disclosure disclosed in the present document may be applied.

Referring to FIG. 26 , the contents streaming system to which thepresent disclosure is applied may largely include an encoding server,streaming server, web server, media storage, user device, and multimediainput device.

The encoding server compresses content input from multimedia inputdevices such as a smartphone, a camera, a camcorder, etc. into digitaldata to generate a bitstream and transmit the bitstream to the streamingserver. As another example, when the multimedia input devices such assmartphones, cameras, camcorders, etc. directly generate a bitstream,the encoding server may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgenerating method to which the embodiment(s) of the present document isapplied, and the streaming server may temporarily store the bitstream inthe process of transmitting or receiving the bitstream.

The streaming server transmits the multimedia data to the user devicebased on a user's request through the web server, and the web serverserves as a medium for informing the user of a service. When the userrequests a desired service from the web server, the web server deliversit to a streaming server, and the streaming server transmits multimediadata to the user. In this case, the content streaming system may includea separate control server. In this case, the control server serves tocontrol a command/response between devices in the content streamingsystem.

The streaming server may receive content from a media storage and/or anencoding server. For example, when the content is received from theencoding server, the content may be received in real time. In this case,in order to provide a smooth streaming service, the streaming server maystore the bitstream for a predetermined time.

Examples of the user device may include a mobile phone, a smartphone, alaptop computer, a digital broadcasting terminal, a personal digitalassistant (PDA), a portable multimedia player (PMP), navigation, a slatePC, tablet PCs, ultrabooks, wearable devices (ex. smartwatches, smartglasses, head mounted displays), digital TVs, desktops computer, digitalsignage, and the like.

Each server in the content streaming system may be operated as adistributed server, in which case data received from each server may bedistributed.

What is claimed is:
 1. An image decoding method performed by a decodingapparatus, the method comprising: obtaining image information includingprediction related information from a bitstream; determining that anintra prediction is applied for a current block based on the predictionrelated information; performing the intra prediction for the currentblock; and generating reconstructed samples for the current block basedon prediction samples for the current block, wherein the predictionsamples for the current block are generated by performing the intraprediction for the current block, wherein performing the intraprediction for the current block comprising: deriving a first candidateintra prediction mode based on a first neighboring block of the currentblock; deriving a second candidate intra prediction mode based on asecond neighboring block of the current block; constructing an intraprediction mode candidate list of the current block based on the firstcandidate intra prediction mode and the second candidate intraprediction mode; deriving an intra prediction mode for the current blockbased on the intra prediction mode candidate list; and generating theprediction samples for the current block based on the intra predictionmode, wherein the first neighboring block is a left neighboring blocklocated at the lowermost side among neighboring blocks adjacent to aleft boundary of the current block, wherein the second neighboring blockis an upper neighboring block located at the rightmost side amongneighboring blocks adjacent to an upper boundary of the current block,wherein, based on a determination that a size of the current block isW×H, and x and y components of a top-left sample position of the currentblock are xN and yN respectively, the first neighboring block is a blockincluding a sample at the coordinates of (xN−1, yN+H−1), and the secondneighboring block is a block including a sample at the coordinates of(xN+W−1, yN−1), and wherein the intra prediction mode candidate list ofthe current block is constructed based on a case that both the firstcandidate intra prediction mode and the second candidate intraprediction mode are non-angular intra modes.
 2. The method of claim 1,wherein, in the case that both of the first candidate intra predictionmode and the second candidate intra prediction mode are non-angularintra modes, the intra prediction mode candidate list of the currentblock comprises a vertical intra prediction mode of which value is 50, ahorizontal intra prediction mode of which value is 18, an intraprediction mode having a value of 46 being equal to a value derived bysubtracting 4 from the value of the vertical intra prediction mode, andan intra prediction mode having a value of 54 being equal to a valuederived by adding 4 to the value of the vertical intra prediction mode.3. The method of claim 1, wherein, based on a determination that thefirst neighboring block is available, and intra prediction is applied tothe first neighboring block, the first candidate intra prediction modeis derived as an intra prediction mode of the first neighboring block,and wherein based on a determination that the first neighboring block isunavailable, or the intra prediction is not applied to the firstneighboring block, the first candidate intra prediction mode is derivedas a planar intra prediction mode.
 4. The method of claim 1, wherein,based on a determination that the second neighboring block is available,intra prediction is applied to the second neighboring block, and thesecond neighboring block is included in a current CTU, the secondcandidate intra prediction mode is derived as an intra prediction modeof the second neighboring block, and wherein based on a determinationthat the second neighboring block is unavailable, the intra predictionis not applied to the second neighboring block, or the secondneighboring block is not included in the current CTU, the secondcandidate intra prediction mode is derived as a planar intra predictionmode.
 5. The method of claim 1, wherein the intra prediction modecandidate list of the current block is derived as a second intraprediction mode candidate list based on a determination that the firstcandidate intra prediction mode is equal to the second candidate intraprediction mode and a mode value of the first candidate intra predictionmode is larger than a mode value of a DC intra prediction mode which is1, and wherein the second intra prediction mode candidate list isderived based on the first candidate intra prediction mode and an intraprediction mode having a value obtained by subtracting 1 from the firstcandidate intra prediction mode.
 6. The method of claim 1, wherein theintra prediction mode candidate list of the current block is derived asa third intra prediction mode candidate list based on a determinationthat the first candidate intra prediction mode is not equal to thesecond candidate intra prediction mode, both of the first and the secondcandidate intra prediction modes are not larger than a mode value of aDC intra prediction mode, and the sum of mode values of the first andsecond candidate intra prediction modes are larger than or equal to 2,and wherein the third intra prediction mode candidate list is derivedbased on an intra prediction mode having a value obtained by subtracting1 from a larger mode value of mode values of the first and secondcandidate intra prediction modes.
 7. The method of claim 1, wherein theintra prediction mode candidate list of the current block is derived asa fourth intra prediction mode candidate list based on a determinationthat the first candidate intra prediction mode is not equal to thesecond candidate intra prediction mode, both of the first and the secondcandidate intra prediction modes are larger than a mode value of a DCintra prediction mode, and wherein the fourth intra prediction modecandidate list is derived based on an intra prediction mode having avalue obtained by subtracting 1 from a larger mode value of mode valuesof the first and second candidate intra prediction modes.
 8. The methodof claim 5, wherein, based on a determination that the mode value of thefirst candidate intra prediction mode is not larger than the mode valueof the DC intra prediction mode, the intra prediction mode candidatelist of the current block is derived as a second intra prediction modecandidate list.
 9. The method of claim 8, wherein the second intraprediction mode candidate list includes 6 intra prediction modecandidates; and the first intra prediction mode candidate is derived asa planar intra prediction mode, the second intra prediction modecandidate is derived as a DC intra prediction mode, the third intraprediction mode candidate is derived as intra prediction mode 50, thefourth intra prediction mode candidate is derived as intra predictionmode 18, the fifth intra prediction mode candidate is derived as intraprediction mode 46, and the sixth intra prediction mode candidate isderived as intra prediction mode
 54. 10. The method of claim 5, whereinthe constructing the intra prediction mode candidate list of the currentblock further includes: based on a determination that the firstcandidate intra prediction mode is not the same as the second candidateintra prediction mode, deriving a first intra prediction mode candidateof the intra prediction mode candidate list as the first candidate intraprediction mode and a second intra prediction mode candidate of theintra prediction mode candidate list as the second candidate intraprediction mode; and deriving the remaining intra prediction modecandidates of the intra prediction mode candidate list based on whetherthe mode values of the first candidate intra prediction mode and thesecond candidate intra prediction mode are larger than that of the DCintra prediction mode.
 11. The method of claim 10, wherein, based on adetermination that the mode values of the first candidate intraprediction mode and the second candidate intra prediction mode arelarger than that of the DC intra prediction mode, the third intraprediction mode candidate is derived as the planar intra predictionmode, the fourth intra prediction mode candidate is derived as the DCintra prediction mode, and the fifth intra prediction mode candidate andthe sixth intra prediction mode candidate are derived based on adifference between the mode values of the largest candidate intraprediction mode and the smallest candidate intra prediction mode. 12.The method of claim 11, wherein, based on a determination that adifference between the mode values of the largest candidate intraprediction mode and the smallest candidate intra prediction mode is not1 nor 64, the fifth intra prediction mode candidate is derived as anintra prediction mode represented by a value obtained by subtracting 1from the mode value of the first candidate intra prediction modeaccording to modular arithmetic, and the sixth intra prediction modecandidate is derived as an intra prediction mode represented by a valueobtained by adding 1 to the mode value of the first candidate intraprediction mode according to the modular arithmetic.
 13. The method ofclaim 12, wherein the candidate intra prediction with the larger modevalue between the first candidate intra prediction mode and the secondintra prediction mode is derived as the largest candidate intraprediction mode, and the candidate intra prediction mode with thesmaller mode value between the two is derived as the smallest candidateintra prediction mode.
 14. An image encoding method performed by anencoding apparatus, the method comprising: determining that an intraprediction is applied for a current block; performing the intraprediction for the current block; generating residual samples for thecurrent block based on prediction samples for the current block, whereinthe prediction samples for the current block are generated by performingthe intra prediction for the current block; generating predictionrelated information based on the prediction samples for the currentblock; generating residual information based on the residual samples forthe current block; and encoding image information including theprediction related information and the residual information to output abitstream, wherein performing the intra prediction for the current blockcomprising: deriving a first candidate intra prediction mode based on afirst neighboring block of the current block; deriving a secondcandidate intra prediction mode based on a second neighboring block ofthe current block; constructing an intra prediction mode candidate listof the current block based on the first candidate intra prediction modeand the second candidate intra prediction mode; determining an intraprediction mode for the current block based on the intra prediction modecandidate list; and generating the prediction samples for the currentblock based on the intra prediction mode, wherein the first neighboringblock is a left neighboring block located at the lowermost side amongneighboring blocks adjacent to a left boundary of the current block,wherein the second neighboring block is an upper neighboring blocklocated at the rightmost side among neighboring blocks adjacent to anupper boundary of the current block, wherein, based on a determinationthat a size of the current block is W×H, and x and y components of atop-left sample position of the current block are xN and yNrespectively, the first neighboring block is a block including a sampleat the coordinates of (xN−1, yN+H−1), and the second neighboring blockis a block including a sample at the coordinates of (xN+W−1, yN−1), andwherein the intra prediction mode candidate list of the current block isconstructed based on a case that both the first candidate intraprediction mode and the second candidate intra prediction mode arenon-angular intra modes.
 15. The method of claim 14, wherein, in thecase that both of the first candidate intra prediction mode and thesecond candidate intra prediction mode are non-angular intra modes, theintra prediction mode candidate list of the current block comprises avertical intra prediction mode of which value is 50, a horizontal intraprediction mode of which value is 18, an intra prediction mode having avalue of 46 being equal to a value derived by subtracting 4 from thevalue of the vertical intra prediction mode, and an intra predictionmode having a value of 54 being equal to a value derived by adding 4 tothe value of the vertical intra prediction mode.
 16. The method of claim14, wherein, based on a determination that the first neighboring blockis available, and intra prediction is applied to the first neighboringblock, the first candidate intra prediction mode is derived as an intraprediction mode of the first neighboring block, and wherein based on adetermination that the first neighboring block is unavailable, or theintra prediction is not applied to the first neighboring block, thefirst candidate intra prediction mode is derived as a planar intraprediction mode.
 17. The method of claim 14, wherein, based on adetermination that the second neighboring block is available, intraprediction is applied to the second neighboring block, and the secondneighboring block is included in a current CTU, the second candidateintra prediction mode is derived as an intra prediction mode of thesecond neighboring block, and wherein based on a determination that thesecond neighboring block is unavailable, the intra prediction is notapplied to the second neighboring block, or the second neighboring blockis not included in the current CTU, the second candidate intraprediction mode is derived as a planar intra prediction mode.
 18. Themethod of claim 14, wherein the intra prediction mode candidate list ofthe current block is derived as a second intra prediction mode candidatelist based on a determination that the first candidate intra predictionmode is equal to the second candidate intra prediction mode and a modevalue of the first candidate intra prediction mode is larger than a modevalue of a DC intra prediction mode which is 1, and wherein the secondintra prediction mode candidate list is derived based on the firstcandidate intra prediction mode and an intra prediction mode having avalue obtained by subtracting 1 from the first candidate intraprediction mode.
 19. The method of claim 14, wherein the intraprediction mode candidate list of the current block is derived as athird intra prediction mode candidate list based on a determination thatthe first candidate intra prediction mode is not equal to the secondcandidate intra prediction mode, both of the first and the secondcandidate intra prediction modes are not larger than a mode value of aDC intra prediction mode, and the sum of mode values of the first andsecond candidate intra prediction modes are larger than or equal to 2,and wherein the third intra prediction mode candidate list is derivedbased on an intra prediction mode having a value obtained by subtracting1 from a larger mode value of mode values of the first and secondcandidate intra prediction modes.
 20. A non-transitory computer-readablestorage medium storing a bitstream of image information generated by amethod, the method comprising: determining that an intra prediction isapplied for a current block; performing the intra prediction for thecurrent block; generating residual samples for the current block basedon prediction samples for the current block, wherein the predictionsamples for the current block are generated by performing the intraprediction for the current block; generating prediction relatedinformation based on the prediction samples for the current block;generating residual information based on the residual samples for thecurrent block; and encoding the image information including theprediction related information and the residual information to outputthe bitstream, wherein performing the intra prediction for the currentblock comprising: deriving a first candidate intra prediction mode basedon a first neighboring block of the current block; deriving a secondcandidate intra prediction mode based on a second neighboring block ofthe current block; constructing an intra prediction mode candidate listof the current block based on the first candidate intra prediction modeand the second candidate intra prediction mode; deriving an intraprediction mode for the current block based on the intra prediction modecandidate list; and generating the prediction samples for the currentblock based on the intra prediction mode, wherein the first neighboringblock is a left neighboring block located at the lowermost side amongneighboring blocks adjacent to a left boundary of the current block,wherein the second neighboring block is an upper neighboring blocklocated at the rightmost side among neighboring blocks adjacent to anupper boundary of the current block, wherein, based on a determinationthat a size of the current block is W×H, and x and y components of atop-left sample position of the current block are xN and yNrespectively, the first neighboring block is a block including a sampleat the coordinates of (xN−1, yN+H−1), and the second neighboring blockis a block including a sample at the coordinates of (xN+W−1, yN−1), andwherein the intra prediction mode candidate list of the current block isconstructed based on a case that both the first candidate intraprediction mode and the second candidate intra prediction mode arenon-angular intra modes.